jquery show() function


  Translation results:

show

英[ʃəʊ] 美[ʃoʊ]

vt.& vi. Show; show to…see; reveal; perform

vt.Explain; explain; instruct; demonstrate

n.Display;performance;exhibition;appearance

vi.Be seen, show up, be obvious

jquery show() functionsyntax

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

Syntax: $(selector).show(speed,callback)

Parameters:

ParameterDescription
speed Optional. Specifies how quickly an element goes from hidden to fully visible. Default is "0". Possible values: milliseconds (e.g. 1500) "slow" "normal" "fast" When setting the speed, the element will gradually change its height, width, margins, and padding as it goes from hidden to fully visible. and transparency.
callback Optional. The function to be executed after the show function is executed. This parameter cannot be set unless the speed parameter is set.

Note: If the element is already fully visible, the effect will not change unless a callback function is specified. The effect works on elements hidden via jQuery, or elements with display:none declared in CSS (but not elements with visibility:hidden ).

jquery show() functionexample

<html>
<head>
<script type="text/javascript" src="http://apps.bdimg.com/libs/jquery/2.1.1/jquery.min.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 instance »

Click the "Run instance" button to view the online instance

Popular Recommendations

Home

Videos

Q&A