I started working with jQuery again after a few months and am a little confused. I went to news.ycombinator.com, went to the console in chrome, and typed $('tr') to get an array of rows, but it only returned the first row (even though the first table has 3 rows).
When I type var x = $('tr:odd') in the chrome console, I get the error
Uncaught DOMException: Failed to execute 'querySelector' on 'Document': 'tr:odd' is not a valid selector.
Am I missing something obvious?
Want an array of all the "tr" tags?
The site doesn't use jQuery. Try with regular Javascript in the console:
document.getElementsByTagName("tr")
That will return an array with all the "tr" tags that exist in the DOM.
To use the "$" to select elements, the site must load jQuery on the header.
Now, what do you want to do with that selection?
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With