This article mainly introduces the usage of show and hide methods in jQuery, and analyzes the simple implementation techniques of jQuery using show and hide methods to control the display and hiding of page elements in the form of examples. Friends who need it can refer to it
This article analyzes the usage of show and hide methods in jQuery through examples. Share it with everyone for your reference, the details are 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></title> <style type="text/css"> *{font-size:12px;} p{width:600px;margin:auto;} #control{background-color:gold;padding:10px;} </style> <script src="../js/jquery-1.5.1.min.js" type="text/javascript"></script> <script type="text/javascript"> $(function () { $("#btnDisplay").click(function () { $("#message").show(3000); }); $("#btnHide").click(function () { $("#message").hide(3000); }); }); </script> </head> <body> <p id="control"> <input id="btnDisplay" type="button" value="显示p" /> <input id="btnHide" type="button" value="隐藏p" /> </p> <p id="message"> mouseover、mouseenter的区别:p里套p。见备注。和事件冒泡有关系。<br /> 不论鼠标指针穿过被选元素或其子元素,都会触发 mouseover 事件 <br /> 只有在鼠标指针穿过被选元素时,才会触发 mouseenter 事件(穿过子元素不会触发) </p> </body> </html>
The above is the detailed content of Examples of usage of show and hide methods in jQuery. For more information, please follow other related articles on the PHP Chinese website!