[jQuery] class keyup() get id
hello,
folowing problem:
i have to (or more) textareas look like this
<textarea class="comment" id="comment1" rows="6" cols="50"></
textarea><br />
<textarea class="comment" id="comment2" rows="6" cols="50"></
textarea><br />
you see the clas of both is comment so i can combine more textareas to
one keyup (later) and the id is different (this is important for
another thing).
i call this function to get the event when keyup on one of the
textareas with the class comment
$(function(){
$('.comment').keyup(function(){
limitChars('comment1,comment2', 20, 'charlimitinfo');
})
});
now my question is: how can i get the id on wich the keyup was done,
f.e. when i type something into textarea id="comment1" then i want to
know the id?
possible solution is this one, but i can not make a class of
textfareas this one is just for 2 and every time i will add a textarea
i have to add a newline of code here:
$(function(){
$('#comment1').keyup(function(){
limitChars('comment1,comment2', 20, 'charlimitinfo');
})
$('#comment2').keyup(function(){
limitChars('comment1,comment2', 20, 'charlimitinfo');
})
});
thanks