I have several textareas, which the ids are different from each other and I do not want to replicate several jquery to perform on the textarea ids. How can I alter my jquery code to perform on the textareas with different ids?
I have this jquery function now:
var text_max = 2000;
$('#count_message').html(text_max + ' characters left');
$('#ox_AcitivityForms_YouthActivity__remark').keyup(function() {
var text_length = $('#ox_AcitivityForms_YouthActivity__remark').val().length;
var text_remaining = text_max - text_length;
$('#count_message').html(text_remaining + ' characters left');
});
Here are my HTML codes:
<textarea id="ox_AcitivityForms_YouthActivity__remark" name="ox_AcitivityForms_YouthActivity__remark"</textarea>
<p style="font-size:10pt; text-align:right;" id="count_message"></p>
Please note that the textarea id above is one of the ids that I have. There are a few more eg. ox_AcitivityForms_SportActivity__remark, ox_AcitivityForms_WelfareActivity__remark and so on.
Any clues provided are appreciated.