GimmeObject.element([n])

Description
Retrieves a native DOM element from the GimmeObject's underlying collection.

Params
n, (optional / default = 0): Index of the desired element within the GimmeObject to retrieve

Returns
A native DOM element if one exists at the specified index,
null otherwise

Example

// finds the first <div> element found in the document (or null if no <div> elements are found)
var firstDiv  = Gimme('div').element();

// finds the first <p> element found in the document (or null if no <p> elements are found)
var firstP = Gimme('p').element(0);

// finds the 3rd <span> element that is a descendant of a <p> element (or null if no 3rd <span> descendant of a <p> exists)
var thirdSpan = Gimme('p span').element(2);

// finds the element whose id is "foo"
Gimme("#foo).element()


See Also
  • GimmeObject Indexer (square-bracket notation for accessing underlying elements in a GimmeObject)

Last edited Jul 16, 2010 at 6:39 PM by sstchur, version 4

Comments

No comments yet.