Home > Web Front-end > JS Tutorial > body text

Implementation code for textarea character limit in JQuery form_jquery

WBOY
Release: 2016-05-16 18:40:01
Original
1010 people have browsed it
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.
Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template