Hii I want to show numeric characters for the closest div with the showchars class.
I tried to do this:
$('#maina').focus(function() { $(this).closest("div.showchars").find(".countchars").html("KKK"); $("#error-1").html(""); $(this).closest(".showchars").html("hmm"); });
With this html:
<tr> <td> Main Alliase/Current Alliase: </td> <td><input type="text" id="maina" class="countchars"/><br /> <div class="showchars">o</div> </td> <td><span id="handle-1" class="selector">?</span></td> <td><div id="error-1" class="errors"></div></td> </tr>
When I focus on input fields, it dumps the contents of the error class.
But does not change the text to: hmm in the div.
Where am I mistaken or the best way to get the closest div and then implement api: .html("hmm") ?
thanks
source share