how to use this class instead of this id ?

Hello Everyone,
How can I change the id calling from the textarea to a class ? Thank you :slight_smile:

<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>
Sponsor our Newsletter | Privacy Policy | Terms of Service