find Function

Searches all child nodes for a specific match of "attr" to "val". Returns an object with the method "add()" to perform a another search and add to the results, "first()" and "last()" which return the first or last node in the results, and "each()", which receives 2 arguments: a callback function to execute for every node in the results, and a value, which if equals a value returned by the callback function will break the iteration. The callback function recieves 2 arguments: the array of results from the search, and the numeric index of the current node in the results. The scope of "this" within the callback is the cirrent node wrapped in the API.

Summary

ElementFunction
ReturnsObject

Arguments

attrStringThe type of search to perform. If a value is given which is not "tag", "text", "css" or "style", an attribute name will be assumed.
valString|Number|regexpThe value to search for. Can be a regular expression, although caution is advised due to possible script timeout when recursive.
deepBooleanMakes the search recursive if set to "true".
nodeObjectThe DOM node from which to start the search. If not specified defaults to "document"
objObjectThe current Object containing the results of the search. Only used internally.

Example

nano.find('text', 'something', true);