Home  >  Article  >  Web Front-end  >  Implementation code for textarea character limit in JQuery form_jquery

Implementation code for textarea character limit in JQuery form_jquery

WBOY
WBOYOriginal
2016-05-16 18:40:011011browse
Copy code The code is as follows:

$('#FashionStatement').val('');
var limitNum = 1000;
var pattern = 'You can also enter 'limitNum' word';
$('#statementRowChk').html(pattern);
$('#FashionStatement'). keyup(
function() {
var remain = $(this).val().length;
if (remain > 1000) {
pattern = $('The number of words exceeds the limit, please Delete some content appropriately');
}
else {
var result = limitNum - remain;
pattern = 'You can also enter the word 'result';
}
$( '#statementRowChk').html(pattern);
}
);

This program is easy to understand at a glance, so I won’t explain it.
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn