Hot Tip #1: Access Elements by Javascript Array Indexing

Application of a selector creates a Javascript array which can be used for accessing DOM elements with array index easily.

For Example:

var element = $("img")[2];

will set the variable element to the second <img> element in the matched set of document's all <img> elements.

Hot Tip #2: Create Union of Elements with Multiple Selectors

Union of multiple selectors can be created by listing selectors separated by commas 'n a s'ngle call to $()

For Example:


will match all <img> and <p> elements, while the following matches all <div> elements with a title attribute and all <img> elements with alt attributes.


Hot Tip #3: Be Careful with not() and remove() methods!

.not() method removes elements from the matched set while the .remove() method removes the elements in the matched set from the HTML DOM.

Want automatic updates? Subscribe to our RSS feed or
Get Email Updates sent directly to your inbox!

Currently rated 5.0 by 3 people

  • Currently 5/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5


September 24. 2009 11:52

Pingback from technosiastic.wordpress.com

Collection of top jQuery tutorials, tips-tricks & techniques to improve performance « Technosiastic!

technosiastic.wordpress.com | Reply

September 24. 2009 12:26

Nice ones mate. I have also linked to yours from my blog post below where I am trying to collect the most useful and common jQuery code snippets for JavaScript over the web. Here is the title and the link to the jQuery link compilation endeavor:

Ultimate collection of top jQuery tutorials, tips-tricks and techniques to improve performance


Shahriar Hyder | Reply

September 24. 2009 13:01

Thanks Shahriar, I've also cheked your post. Great compliation.

Blogging Developer | Reply

October 22. 2009 18:40

Social comments and analytics for this post

This post was mentioned on Twitter by bloggingdev: Top 3 jQuery Tips for Beginners - http://su.pr/15mMx4

uberVU - social comments | Reply

November 5. 2009 17:28

I don't usually reply on articles I read but I have to say this was just great. Keep up the good work.

PaydayLoans | Reply

November 6. 2009 09:39

Great beginner tips, but I thought it was worth noting that $("img")[2] actually returns the 3rd img element in the document, since it's a zero based index.

Wes | Reply

December 7. 2009 14:51

Pingback from lrodrigues.com

Tutoriais, artigos e referências 06/12 | Leandro Rodrigues

lrodrigues.com | Reply

December 12. 2009 13:35

Pingback from jquery.wisdomplug.com

Top 3 jQuery Tips for Beginners | jQuery Wisdom

jquery.wisdomplug.com | Reply

December 24. 2009 12:52

Good tips!

SMiGL | Reply

January 18. 2010 16:19

Pingback from jesusherman.com

Monday Reads - Web design and development resources for Monday | Jesus Herman - London and Barcelona based web designer and developer

jesusherman.com | Reply

March 15. 2010 14:57

Speak when you're angry, and you'll make the best speech you'll ever regret.

cash loans | Reply

Add comment

(Will not be displayed!)