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>
<Title> new document </title>
<Meta name = "generator" content = "editplus"/>
<Meta name = "author" content = ""/>
<Meta name = "keywords" content = ""/>
<Meta name = "description" content = ""/>
</Head>
<Body>
<! DOCTYPE html>
<Html lang = "en">
<Head>
<Meta charset = "UTF-8"/>
<Title> </title>
<Link type = "text/css" href = ".../../themes/base/jquery.ui.all.css" rel = "stylesheet"/>
<Script type = "text/javascript" src = ".../jquery-1.4.2.js"> </script>
<Script type = "text/javascript" src = "..../external/jquery. bgiframe-2.1.1.js"> </script>
<Script type = "text/javascript" src = ".../ui/jquery. ui. core. js"> </script>
<Script type = "text/javascript" src = ".../ui/jquery. ui. widget. js"> </script>
<Script type = "text/javascript" src = ".../ui/jquery. ui. mouse. js"> </script>
<Script type = "text/javascript" src = ".../ui/jquery. ui. draggable. js"> </script>
<Script type = "text/javascript" src = ".../ui/jquery. ui. position. js"> </script>
<Script type = "text/javascript" src = ".../ui/jquery. ui. resizable. js"> </script>
<Script type = "text/javascript" src = ".../ui/jquery. ui. dialog. js"> </script>
<Link type = "text/css" href = "../demos.css" rel = "stylesheet"/>
<Script type = "text/javascript">
$ (Function (){
// Initial test data
Var init = function (){
$ ("# Con1"). add ("# con3"). data ("key", "10001 ");
};
Init ();
Var select = "mytest ";
Var name = "key ";
// Define a new Selector
$. Expr [":"] [select] = function (elem ){
Return !! $. Data (elem, name );
};
// Use
$ ("Div: mytest"). each (function (){
Alert (this. id); // result: con1 con3
})
});
</Script>
</Head>
<Body>
<Div id = "con1"> </div>
<Div id = "con2"> </div>
<Div id = "con3"> </div>
</Body>
</Html>
</Body>
</Html>