<pclass="desc"><strong>Description: </strong>Check the current matched set of elements against a selector and return true if at least one of these elements matches the selector.</p>
<pclass="arguement"><strong>selector</strong>A string containing a selector expression to match elements against.</p>
</li></ul>
<divclass="longdesc">
<p>Unlike the other filtering and traversal methods, <code>.is()</code> does not create a new jQuery object. Instead, it allows us to test the contents of a jQuery object without modification. This is often useful inside callbacks, such as event handlers.</p>
<p>Suppose we have a list, with two of its items containing a child element:</p>
<p>We can attach a click handler to the <ul> element, and then limit the code to be triggered only when a list item itself, not one of its children, is clicked:</p>
<pre>$('ul').click(function(event) {
if ($(event.target).is('li') ) {
$(event.target).css('background-color', 'red');
}
});</pre>
<p>Now, when the user clicks on the word list in the first item or anywhere in the third item, the clicked list item will be given a red background. However, when the user clicks on item 1 in the first item or anywhere in the second item, nothing will occur, because in those cases the target of the event would be <code><strong></code> or <code><span></code>, respectively.
</p>
</div>
<h3>Examples:</h3>
<divid="entry-examples"class="entry-examples">
<divid="example-0">
<h4>Example: <spanclass="desc">Shows a few ways is() can be used inside an event handler.</span>