$('#id) in Firebug's console, and I'm happy.
Sometimes I can't get the ID of the element. Maybe it doesn't have a name, just a CSS class... but I want to talk to that item specifically.
I know what element I want - look, I'm pointing at it with Firebug's Inspection tool.
Firebug has a "Copy XPath" feature in it, which would give me exactly what I want...
Except it's an XPath expression, and I can't feed that into jQuery post 1.2
To sum it up in a user story:
"As a user I should be able to easily use Firebug and get the jQuery object of (an item I can select) so I can test some jQuery code interactively"
I found jQuery-xpath, and thought about incorporating it into my current project. That has two issues:
- I should only use this in development mode, not in anything else
- I hate to clog up the project with tools only I will use
I checked with my coworkers, and found there was no real excitement over this tool in the project. Yes, this is sad.
So I went and built a bookmarklet
Visit the bookmarklet's page and install it. When you need a jQuery object from an XPath expression, click the bookmarklet. Now you have jquery-xpath loaded into your page (just like the jQuery-ify Bookmarklet).
Now you can:
And you're done.