<td width="162"><span class="required">*</span> Name:</td>
<td width="407">
<label>
<input id="store_name" class="text_field alnum" type="text" minlength="3"
maxlength="30" size="40" name="store_name" style="color: rgb(51, 51, 51);"/>
</label>
</td>
<td class="char_count_area" style="color: green;"/>
I have some jQuery code that goes like this:
$('.text_field').each(function(){
$(this).keyup(function(){
$(this).parent().parent().parent().find('.char_count_area').html(remainingChars);
....
As you can see, I'm trying to reach char_count_area
from text_field
in a rather inefficient manner.
It works, but it goes crazy if I alter the table design slightly.
I've tried using
$(this).closest('.char_count_area').html(remainingChars)
but it doesn't work (characters don't appear).
How can I achieve this using closest
?