施用jquery插件maxlength使文本域中的文本内容动态变化及字数限制
使用jquery插件maxlength使文本域中的文本内容动态变化及字数限制
1.首先下载jquery插件,导入需要的jsp页面。
2.示例代码如下:
<html>
<head>
<script>
$().ready(function(){
$("#policyImp").maxlength({
'feedback': '.policyImpLen'
});
});
</script>
</head>
<body>
<table>
<tr>
<td>
<textarea name="policyImp" rows="5" cols="32" id="policyImp" class="easyui-validatebox" validType="checkMinLength" missingMessage="此处不能为空!" required="true" maxlength="500"></textarea>
<span class="policyImpLen" style="color: red"></span><span style="color: '#808080'">个字</span>
</td>
</tr>
</table>
</body>
</html>
1.首先下载jquery插件,导入需要的jsp页面。
2.示例代码如下:
<html>
<head>
<script>
$().ready(function(){
$("#policyImp").maxlength({
'feedback': '.policyImpLen'
});
});
</script>
</head>
<body>
<table>
<tr>
<td>
<textarea name="policyImp" rows="5" cols="32" id="policyImp" class="easyui-validatebox" validType="checkMinLength" missingMessage="此处不能为空!" required="true" maxlength="500"></textarea>
<span class="policyImpLen" style="color: red"></span><span style="color: '#808080'">个字</span>
</td>
</tr>
</table>
</body>
</html>