2
的數限制我有這樣的:Wysihtml5編輯 - 人物
<div class="row">
<div class="col-md-11">
<label for="" class="control-label">Description<span>*</span></label>
@Html.TextAreaFor(m => m.Description, new { @class = "editor", @maxlength = "500" })<br />
@Html.ValidationMessageFor(model => model.Description)
</div>
</div>
,爲wysihtml5編輯器(使用剃刀引擎)的JS:
<script type="text/javascript">
$('.editor').wysihtml5({
stylesheets: "/Content/css/wysiwyg-color.css",
charset: "utf-8"
})
</script>
所以基本上我想要要做的就是限制字符數(最大500字符)這個字段。如您所見,我已在@Html.TextAreaFor
中設置maxlength
屬性,但它不起作用。
有人可以告訴我如何做到這一點?提前致謝。
不幸的是,沒有工作:\ – mattburnsred
我編輯了我的答案。 –
它似乎沒有工作,警報彈出甚至不顯示。我試着將'editor-sandbox'改爲'wysihtml5-sandbox'和'editor.wysihtml5-sandbox',但沒有發生任何事情。我似乎無法弄清楚爲什麼... – mattburnsred