Hello Everyone,
How can I change the id calling from the textarea to a class ? Thank you
<script>
$(function() {
$("#para-count").each(function() {
var input = '#' + this.id;
counter(input);
$(this).keyup(function() {
counter(input);
});
});
});
function counter(field) {
var val = $.trim($(field).val());
var lineCount = val ? val.split(/[\r\n]+/).length : 0;
jQuery('.paraCount').text(lineCount);
}
</script>
<textarea id="para-count"></textarea>
<br />
Total number of paragraphs: <span class="paraCount"> </span>