Over a million developers have joined DZone.

Easily Get A Single Element With JQuery

·
While jQuery is a great help, a lot of times I just need to grab a single element. It's a real PITA to have to write $('#mydiv').get(0) all the time, so here's a solution:


$.first = function(a, b) {return $(a, b).get(0)};
Topics:

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}