【发布时间】:2016-06-29 20:39:58
【问题描述】:
我有这个:
<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(使用 Razor 引擎):
<script type="text/javascript">
$('.editor').wysihtml5({
stylesheets: "/Content/css/wysiwyg-color.css",
charset: "utf-8"
})
</script>
所以基本上我要做的是限制此字段中的字符数(最大 500 个字符)。如您所见,我在@Html.TextAreaFor 中设置了maxlength 属性,但没有成功。
有人可以告诉我如何做到这一点吗?提前致谢。
【问题讨论】:
标签: javascript c# jquery iframe wysihtml5