3 ms·
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)
by shp0ngle 6y ago
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.
- throwanem 6y agoYep, it's an alias for document.querySelector. $$ aliases document.querySelectorAll, too.
- sfink 6y agoLooks 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`.)
- hiccuphippo 6y agoYou can also use $0 to get the currently selected element in the inspector.