Hello,
I think I have a basic understanding of DOM traversal, but I doubt I'm doing it efficiently.
For example:
<textarea name="description"></textarea>
<p class="notes"><small>100 characters or less <span class="remainder"></span></small></p>
I have a keyup event listener on the textarea. I want the .remainder span to display something like "(50 characters remaining)" as the user types in the textarea.
I am currently accessing the .remainder span like this:
var remainder = $('textarea').next('p').children('small').children('.remainder');
I assume there is a simpler way to do this - maybe through selectors? I am hoping to find some kind of tool, like WebKit's Developer Tools, to visually show me how one element relates to another.
Can anyone tell me if such a thing exists? Any advice you may have on DOM traversal would be much appreciated too.
Thanks!