Never been to DZone Snippets before?

Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world

Easily get a single element with jQuery (See related posts)

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)};

Comments on this post

jonasraoni posts on Aug 10, 2006 at 16:29
Depending on such 3rd-party libraries to make simple codes is the worse thing a person can do :(

You need to create an account or log in to post comments to this site.


Click here to browse all 5147 code snippets

Related Posts