Home > Web Front-end > JS Tutorial > Examples of usage of show and hide methods in jQuery

Examples of usage of show and hide methods in jQuery

巴扎黑
Release: 2017-06-29 10:45:11
Original
2780 people have browsed it

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>
Copy after login

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!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template