jQuery has() Selector

Last Updated Jul 21, 2015, 12:00:06 PM





jQuery has() method

The jQuery has() method returns all elements that have one or more elements inside of them, that matches the specified selector.

Note: To select an element which has multiple elements inside of it, use a comma( , ) .

Syntax

Let us see an example of jQuery has() method

Example
HTML

The above jquery has() method will select all the div elements if it also contains a paragraph in it.

Output
jquery has() method
Try It Now

Other Advanced jQuery Traversing Methods you might want to learn
jQuery Traversal Reference

jQuery Basic Traversing

jQuery Traversal Filters

jQuery Traversing Methods

Sources and Credits

The content and methods in the tutorial has been referred and updated with jQuery API and The jQuery Foundation

Last Updated Jul 21, 2015, 12:00:06 PM