istesequi
Version:
Lightweight and intuitive javascript library
47 lines (24 loc) • 817 B
Markdown
## .find()
Get all of the descendants of the nodes with an optional filter
```js
.find(filter);
```
### Parameters
`filter`: a string containing a selector that nodes must pass or a function that return a boolean. See [.filter()](#filter) for a better explanation
### Return
`u`: returns an instance of Umbrella JS with the new children as nodes
### Examples
Get all of the links within a paragraph
```js
u("p").find('a');
```
Get the required fields within a submitting form:
```js
u('form').on('submit', function(e){
var required = u(this).find('[required]');
});
```
### Related
- [.closest(filter)](#closest) get the first ascendant that matches the selector
- [.parent(filter)](#parent) get all of the direct parents
- [.children(filter)](#find) get the direct child of the matched nodes