Verify the parent selection with is() method in jQuery

Description

The following code shows how to verify the parent selection with is() method.

Example


<!--   ww w. java  2  s . c  o  m-->
<html>
<head>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<script type="text/javascript">
$(document).ready(function(){
alert( $(":checkbox").parent().is("form"));
});
</script>
</head>
<body>
<form><input type="checkbox" /></form>
</body>
</html>

Click to view the demo

The code above generates the following result.

Verify the parent selection with is() method in jQuery
Home »
  Javascript Tutorial »
    jQuery »
      jQuery Select
...
Select the last row in table with last sele...
Select the last table row in jQuery
Select the next and change its text in jQue...
Select the next elements who has certain cl...
Select the next sibling and apply style in ...
Select the previous element for div and set...
Select the second table row with Greater th...
Select third table cells with Element at in...
Select visible element with visible selecto...
Select with Attribute equals ([foo=bar]) se...
Select with Attribute not equal ([foo!=bar]...
F') selector in jQuery' href='Select_with_Child_E_F_selector_in_jQuery.htm'>Select with Child $('E > F') selector in jQ...
Select with Descendant $('E F') selector in...
Select with ID selector $("ul#myList") in j...
Select with Last child selector in jQuery
Select with Multiple expressions $('E, F, G...
Select with Only child (:only-child) select...
Select with Universal selector $('*') in jQ...
Select with attribute begins with selector ...
Select with attribute contains $('[foo*=bar...
Select with attribute contains word $('[foo...
Select with attribute ends with $('[foo$=ba...
Select with attribute exists selector in jQ...
Select with class name selector $(".myClass...
Select with (:empty) empty selector in jQue...
Select with first child selector in jQuery
Select with form input selector (:input) in...
Select with not(negate) selector $(':not(E)...
Select with tag name selector $("div") in j...
Set parent element for a paragraph element ...
Set the selecting context to the document b...
Show hidden elements $(":hidden") in jQuery
Slice a UL list and add style in jQuery
Slice selected elements from start to middl...
Slice selected elements from start to the e...
Use OR operation in filter function in jQue...
Use this selector to get the next element $...
Use two attribute selectors together in jQu...
Verify the parent selection with is() metho...