Home >Web Front-end >JS Tutorial >What is the use of javascript show method

What is the use of javascript show method

藏色散人
藏色散人Original
2021-04-01 15:09:343533browse

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)

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>

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!

Statement:
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