jquery hide() function
Translation results:
hide
英[haɪd] 美[haɪd]
vt.Hide; avoid, conceal, hide; cover, cover
vi .conceal; cover up; cover; cover
n.Animal skin;<mouth>life;<mouth>human skin; a hiding place (for watching wild animals)
jquery hide() functionsyntax
Function: If the selected element has been displayed, hide the element.
Syntax: $(selector).hide(speed,callback)
Parameters:
Parameter | Description |
speed | Optional. Specifies how quickly an element goes from visible to hidden. Default is "0". Possible values: milliseconds (e.g. 1500) "slow" "normal" "fast" When setting the speed, the element will gradually change its height, width, margin, padding and transparency. |
callback | Optional. The function to be executed after the hide 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.
jquery hide() 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>
Click the "Run instance" button to view the online instance