我正在使用asp.net core 2创建一个表单,我想计算当用户正在键入但它不起作用时剩余的字符数,所以在我尝试过的视图中
<div id="counter" class="error"></div>
@Html.TextArea("Text2", new { @id = "Text2" })
还有这个
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>
<script src="~/Scripts/MaxLength.min.js"></script>
<script type="text/javascript">
$(function () {
//Specifying the Character Count control explicitly.
$("#Text2").MaxLength(
{
MaxLength: 15,
CharacterCountControl: $('#counter')
});
});
});