Core code:
Copy codeThe Code is as follows: if ($ ("# elem_id"). is (": hidden "))
{
}
Instance code 1:Copy codeThe Code is as follows: <! Doctype html public "-// W3C // dtd html 4.01 Transitional // EN" "http://www.w3.org/TR/html4/loose.dtd">
<Html>
<Head>
<Title> New Document </title>
<Meta name = "Generator" content = "EditPlus">
<Meta name = "Author" content = "">
<Meta name = "Keywords" content = "">
<Meta name = "Description" content = "">
<Script type = "text/javascript" src = "jquery-1.4.2.js">
<! --
// -->
</Script>
<Script type = "text/javascript">
<! --
$ (Document). ready (function (){
$ ("# BtnToogle"). click (function (){
$ ("# DvTest"). toggle ();
Alert ($ ("# dvTest"). is (": visible"); // determines whether the element is displayed or hidden.
});
$ ("# BtnTestIs"). click (function (e ){
// Alert (identifier (e.tar get). is ("input"); // you can specify the name of an element.
Alert ($ ("# btnToogle"). parent (). is ("body "));
});
});
// -->
</Script>
</Head>
<Body>
<Input type = "button" value = "toogle div" id = "btnToogle">
<Div style = "width: 50px; height: 100px; border: solid 1px red; background-color: blue;" id = "dvTest">
</Div>
<Br/>
<Hr/>
<Input type = "button" value = "toogle div" id = "btnTestIs">
</Body>
</Html>
Jquery checks whether div hides instances Copy codeThe Code is as follows: <! DOCTYPE html PUBLIC "-// W3C // dtd xhtml 1.0 Transitional // EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<Html xmlns = "http://www.w3.org/1999/xhtml">
<Head>
<Meta http-equiv = "Content-Type" content = "text/html; charset = UTF-8"/>
<Title> bind a function </title>
<Script src = "jquery-1.3.2.js"> </script>
<Script>
$ (Document). ready (function (){
Var temp = $ ("# test"). is (": hidden"); // hide
Var temp1 = $ ("# test"). is (": visible"); // visible
Alert (temp );
Alert (temp1 );
}); </Script>
</Head>
<Body>
<P onclick = 'test () '> refresh test </p>
<Div id = "test" style = "display: none"> </div>
</Body>
</Html>