jQuery: .filter()

This entry is part 29 of 33 in the series jQuery Tutorial

.filter() reduces the set of matched elements to those that match the selector or pass the function’s test.

<!doctype html>
    <title>eq demo</title>
    <script src='//code.jquery.com/jquery-1.10.2.js'></script>
        li {
            background: yellow;

        .blue {
            background: blue;

    <li>list item 1</li>
    <li>list item 2</li>
    <li>list item 3</li>
    <li>list item 4</li>
    <li>list item 5</li>
    <li>list item 6</li>



Try The Code

There are 6 list items in the list and we have used :even selector to select the even number list.

Series Navigation<< jQuery: .eq()
jQuery: siblings >>

Leave a comment

Leave a Reply