<! DOCTYPE HTML PUBLIC "-//w3c//dtd HTML 4.01 transitional//en"
"Http://www.w3.org/TR/html4/loose.dtd" >
<meta http-equiv= "Content-type" content= "text/html; Charset=utf-8 "/>
<title>new Web project</title>
<style type= "Text/css" >
. myred{
BORDER:4PX solid red;
}
</style>
<script src= "Js/jquery1.11.1.js" ></script>
<script src= "Js/jquery-migrate-1.2.0.js" ></script>
<script type= "Text/javascript" >
$ (function () {
/* $ ("input"). focus (function () {
$ (this). CSS ("Background", "pink");
}). blur (function () {
$ (this). CSS ("Background", "");
});*/
/* $ ("input"). Bind (' Focus ', function () {
$ (this). CSS ("Background", "pink");
}). bind (' blur ', function () {
$ (this). CSS ("Background", "");
});*/
5 minutes, bind an event with a bind
/* $ ("input"). Bind (' Focus ', function () {
$ (this). CSS ("Background", "pink");
}). bind (' blur ', function () {
$ (this). CSS ("Background", "");
});*/
/*$ ("Input"). Bind (
{
Focus:function () {
$ (this). CSS ("Background", "pink");
},
Blur:function () {
$ (this). CSS ("Background", "");
}
});*/
$ ("input"). On (
{
Focus:function () {
$ (this). CSS ("Background", "pink");
},
Blur:function () {
$ (this). CSS ("Background", "");
}
});
Uninstall all events, but not ()
$ ("input"). Unbind ("focus Blur");
$ ("input"). Off ("focus Blur");
Live
$ ("ul"). Delegate ("Li", {
Mouseover:function () {
$ (this). CSS ("Background", "pink");
},
Mouseout:function () {
$ (this). CSS ("Background", "");
}
});
$ ("#btnAdd"). Live (' click ', function () {
Shenzhen
var $obj = $ ("<li> Shenzhen </li>");
$ ("ul"). Append ($obj);
}
);
});
</script>
<body>
User name: <input type= "text"/>
Password: <input type= "Password"/>
<ul>
<li> Beijing </li>
<li> Shanghai </li>
<li> Guangzhou </li>
</ul>
<input id= "Btnadd" value= "Add Node" type= "button"/>
</body>
After the 1.9 version of jquery no longer supports on, live function events, it is necessary to introduce the corresponding Jquery-migrate-1.2.0.js plug-in package.
Bind,unbing,on,live,delegate Binding and Reconciling events