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
Element | Function |
Returns | Object |
Arguments
attr | String | The type of search to perform. If a value is given which is not "tag", "text", "css" or "style" an attribute name will be assumed. |
val | String|Number|regexp | The value to search for. Can be a regular expression, although caution is advised due to possible script timeout when recursive. |
deep | Boolean | Makes the search recursive if set to "true". |
Example
nano.find('innerHTML', 'something', true);
|