Copy Code code as follows:
$ (function () {
$ ("#input"). focus (function () {//#input换成你的input的ID
This writes the code that runs after the focus is obtained.
}). blur (function () {
$ (". Scroll-question"). CSS ("display", "none");
});
})
})
Live to 1.4 to support, the following ie,firefox are no problem
Copy Code code as follows:
<! DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 transitional//en" "Http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd ">
<meta http-equiv= "Content-type" content= "text/html; Charset=utf-8 "/>
<title> Untitled Document </title>
<script src= "/js/jquery-1.4.4.js" ></script>
<script>
$ (document). Ready (function ()
{
$ ("#nameBefore"). DblClick (function ()
{
$ ("#nameBefore"). ReplaceWith ("<div id= ' Namein ' ><input type= ' text ' name= ' nameinval ' id= ' nameinval ', ' value= '") In '/></div> ');
}
);
After losing focus
$ ("#nameInVal"). Live ("Blur", function ()
{
Alert (' Nameinval has lost focus ');
}
);
}
);
</script>
<body>
<form name= "TESTFM" method= "post" action= "save.php" >
<table>
<tr><td>1</td><td><div id= ' Namebefore ' >Before</div></td></tr>
</table>
</form>
</body>