如果用户输入的字符多于 a 允许的字符textarea
,我该如何截断它们?
相关代码:
<script type="text/javascript">
$(document).ready(function(){
//default usage
$("#message1").charCount();
//custom usage
$("#message2").charCount({
allowed: 50,
warning: 20,
counterText: 'Characters left: '
});
});
</script>
<label for="message">Type your message</label>
<textarea id="message1" name="message1"></textarea>