English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية

jQuery filter() Method

jQuery can be used for filtering/Search for a specific element in a set of elements.

jQuery filter() Method

jQuery filter()The method returns elements that match the specific conditions.

This method filters out all elements that do not meet the selected conditions and returns those that match.

Filter table

The following example performs a case-insensitive search on the items in the table:

Enter content in the input field to search for names, cities, or phones in the table:


NameCityPhone
SeagullNew Delhi999945850
EspyMidazolam8425896528
MuditJaipur9858621233
AnkitMumbai9560478555
NancyNew Delhi9210154545
Run Code

Example Explanation:

  • filter()Method to check if any text value matches the value of the input field

  • toggle()Method to hide lines that do not match the search

  • toLowerCase()Method to convert text to lowercase, making the search case-insensitive

Filter list

The following example performs a case-insensitive search on the items in the list:

Enter content in the input field to search list items:


  • London

  • New Delhi

  • Beijing

  • Mumbai

  • Bangalore

Run Code

Filter other elements

The following example performs a case-insensitive search within the DIV element:

Enter content in the input field:


This is the first paragraph.

This is the second paragraph.

This is a DIV element.

This is the last paragraph.

Run Code