jQuery filter() Method

Read the tutorial on YogiHosting »

1. Filter paragrpahs having class as "testClass"

Paragraph with "testClass"

Paragraph with "testClass"

Paragraph

Paragraph

Paragraph with "testClass"

2. Filter paragrpahs having class as "testClass" or id as "test"

Paragraph with "testClass"

Paragraph with id "test"

Paragraph

Paragraph

Paragraph

3. Filter paragrpahs having jQuery object - Here 3rd paragraph

Paragraph

Paragraph

Paragraph

Paragraph

4. Filter paragrpahs using function - paragraphp with 3 span elements

A p element with one span element.

A p element with three span elements.

A p element with one span element.

A p element with two span elements.

A p element with no span element.

5. Filter even paragrpahs

Paragraph

Paragraph

Paragraph

Paragraph

6. Filter odd paragrpahs

Paragraph

Paragraph

Paragraph

Paragraph