Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Another tip I found very useful lately

You can use `$("selector")`, even without jQuery, in console. (not sure if with firefox, works with safari and chrome)

And also `$x("path")` for xpath.

But note, this works only in console, it’s not available from javascript.



Looks like Firefox gives you `document.getElementById` with `$`. You need $$("selector") for `document.querySelectorAll`. Or rather, it looks like it does something like `[...document.querySelectorAll(arg)]` (it returns an `Array` not a `NodeList`.)


You can also use $0 to get the currently selected element in the inspector.


Yep, it's an alias for document.querySelector. $$ aliases document.querySelectorAll, too.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: