Home > Web Front-end > JS Tutorial > body text

What is the use of javascript show method

藏色散人
Release: 2023-01-04 09:33:54
Original
3480 people have browsed it

The javascript show method is used to display hidden elements, and its usage syntax is "$(selector).show(speed,callback)"; this effect applies to elements hidden through jQuery, or in CSS Elements that declare "display:none".

What is the use of javascript show method

The operating environment of this tutorial: Windows 7 system, jquery version 3.2.1, Dell G3 computer.

show method definition and usage

If the selected elements have been hidden, display these elements:

Syntax

$(selector).show(speed,callback)
Copy after login

What is the use of javascript show method

Tips and Notes

Tips: If the element is already fully visible, the effect will not change unless a callback function is specified.

Note: This effect applies to elements hidden through jQuery, or elements declared with display:none in CSS (but not elements with visibility:hidden).

Example:

<html>
<head>
<script type="text/javascript" src="/jquery/jquery.js"></script>
<script type="text/javascript">
$(document).ready(function(){
  $(".btn1").click(function(){
  $("p").hide();
  });
  $(".btn2").click(function(){
  $("p").show();
  });
});
</script>
</head>
<body>
<p>This is a paragraph.</p>
<button class="btn1">Hide</button>
<button class="btn2">Show</button>
</body>
</html>
Copy after login

Run:

What is the use of javascript show method

##[Recommended learning:

js basic tutorial

The above is the detailed content of What is the use of javascript show method. 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