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:

$(“img,p”)

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.

$(“div[title],img[alt]“)

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.

Related Resources:

Related posts:

  1. Setting Focus to an ASP.NET Control – Set Focus After PostBack – After Submit – on Page Load in ASP.NET 1.x
  2. CSS Problem Solving Tips
  3. Web Form Enhancement with jQuery Plugins and Tools
  4. Top CSS Tips
  5. .NET Style String Formatting with jQuery – Javascript Function to Support Token Replacement within a String