AJAX
Basics
Data
DOM
Effects
Events
Forms
jQuery UI
Plug Ins
Traversing
The filter()
method lets you specify a criteria.
Elements that do not match the criteria are removed from the selection, and those that match will be returned.
This example will apply css to the lis which have a class of foo.
<ul id="example1">
<li class="foo">list item 1</li>
<li>list item 2</li>
<li> class="foo">list item 3</li>
<li>list item 4</li>
<li> class="foo">list item 5</li>
</ul>
$("#btnDemo").click(function ()
{
$("#example1 li").filter(".foo").css({ "border-color": "red", "border-width": "3px", "border-style": "solid" });
});