So I had a general question. Often, while traversing different tree elements I find that the JQuery selector that I think I need ends up selecting something else, or much worse, it seems to select nothing.
For example sometimes using .child() or .sibling() it is easy to lose track of what is actually being selected.
Sometimes I can use alert()s or a console.log() to isolate the problem. Sometimes though even that doesn’t do the trick. I was curious whether anyone knew of any good tricks to know what (if anything) the selector I am using has actually selected. I don’t know if there is any firebug tools, or something else that is useful.
Any suggestions? Thanks alot.
There is this Chrome extension , i don’t know if it is available for Firefox also, but you can always try it.
Besides i always `console.log()` everything to make sure i’m selecting the right element, on nested trees for example if you’re targeting `div > ul > li > a` I `console.log($(div))` first and then i just add to the jQuery selector
And lastly i just `$(element).css(‘background-color’,’red’);` so i can locate visually what i’m targeting