jquery get() method

Since I learned about jQuery I’ve wondered why it didn’t give you access to the original DOM elements that it selects.  Well, it turns out that it does.  Unfortunately I didn’t find it sooner because it doesn’t work the way you’d expect it to.  The method is get().

You’d expect it to work like this…
var selectedElement = $('#divIdToSelect').get();

Unfortunately that returns undefined.  Instead you must pass the get method an index since the jQuery object is essentially an array.
var selectedElement = $('#divIdToSelect').get(0);

This second method works beautifully!  I’ve been able to get by for the most part with out this method because jQuery is so complete but this really puts the icing on the cake that is jQuery!

Read previous post:
WAT-C Web Accessibility Tools Consortium

The Contrast Tool is great!  I'll have to take a look at what other tools they have. Color Contrast Analyzer http://www.wat-c.org/tools/CCA/LCRA/index.html...

Close