jQuery
New Wave Javascript


This code is part of the the jQuery Base module.

Iterator Methods

size()

Returns the number of matched elements.

Example:

alert($("p").size());

get()

Returns an array of all elements matched.

Example:

alert($("p").get());

get(N)

If N is provided, returns the Nth element matched.

Example:

alert($("p").get(0));

each(Function)

Executes this function against every element matched. The scope of the function is within the element itself, to make coding simpler. The function is also passed a single parameter containing the index of the element within the matched element set.

Example:

$("p").each(function(i){
  this.innerHTML = this + " is the Element, " + 
    i + " is the Position";
});