hidden




Этот атрибут скрывает элемент.




index.html
  • <!DOCTYPE html>
  • <html>
  • <head>
  •  <meta charset="utf-8" />
  •  <title>New Page</title>
  •  <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
  • </head>
  • <body>
  •  <div class="a">
  •   <button onclick="funShow()">Show</button>
  •   <br />
  •   <br />
  •   <button onclick="funHide()">Hide</button>
  •  </div>
  •  <div id="d1" hidden="hidden">
  •   <p>Hello World!</p>
  •  </div>
  •  <script>
  •   function funShow() {
  •    document.getElementById("d1").style.display = "block";
  •   }
  •   function funHide() {
  •    document.getElementById("d1").style.display = "none";
  •   }
  •   $(document).ready(function () {
  •    $("*").css("margin", "0").css("padding", "0");
  •    $(".a").css("padding", "20px");
  •    $("button").css("width", "60px");
  •    $("#d1").css({ "width": "500px", "height": "500px", "position": "absolute", "left": "50%", "top": "50%", "margin-left": "-250px", "margin-top": "-250px", "text-align": "center", "line-height": "500px", "background-color": "#EEFCCD", "font-size": "50px" });
  •   });
  •  </script>
  • </body>
  • </html>
  • <!DOCTYPE html>
  • <html>
  • <head>
  •  <meta charset="utf-8" />
  •  <title>New Page</title>
  •  <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
  • </head>
  • <body>
  •  <div class="a">
  •   <button onclick="funShow()">Show</button>
  •   <br />
  •   <br />
  •   <button onclick="funHide()">Hide</button>
  •  </div>
  •  <div id="d1" hidden="hidden">
  •   <p>Hello World!</p>
  •  </div>
  •  <script>
  •   function funShow() {
  •    document.getElementById("d1").style.display = "block";
  •   }
  •   function funHide() {
  •    document.getElementById("d1").style.display = "none";
  •   }
  •   $(document).ready(function () {
  •    $("*").css("margin", "0").css("padding", "0");
  •    $(".a").css("padding", "20px");
  •    $("button").css("width", "60px");
  •    $("#d1").css({ "width": "500px", "height": "500px", "position": "absolute", "left": "50%", "top": "50%", "margin-left": "-250px", "margin-top": "-250px", "text-align": "center", "line-height": "500px", "background-color": "#EEFCCD", "font-size": "50px" });
  •   });
  •  </script>
  • </body>
  • </html>