jQuery: The Write Less, Do More JavaScript Library

Error: Failed to load processor NavWiki
No macro or processor named 'NavWiki' found

This code is part of the the jQuery Base? module.

Iterator Methods

size()

Description

Returns the number of matched elements.

Examples

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

get()

Description

Returns an array of all elements matched.

Examples

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

get(N)

Parameters

Error: Failed to load processor param
No macro or processor named 'param' found

If N is provided, get() returns the Nth element matched.

Examples

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

each(Function)

Parameters

Error: Failed to load processor param
No macro or processor named 'param' found

Description

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.

Note

Inside the function passed to each, use this to refer to the actual DOMElement being operated on.

Examples

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