hide and show

Through the css method of jquery, set the div to hide

code show as below:

$("#sendPhoneNum").css("display", "none");  

hide() function, if the selected element has been displayed, hide the element.

grammar:

$(selector).hide(speed,callback)

To achieve hiding, you can take a time parameter (milliseconds) in parentheses. For example, hide(2000) hides at a speed of 2000 milliseconds, and you can also bring slow, fast

show() function

grammar:

*.show(speed, [callback])

Displays all matching elements, and optionally triggers a callback function when the display is complete. There are speed parameters and optional callback parameters, speed represents the displayed time in milliseconds, followed by optional functions

The toggle() method toggles the visible state of an element.

grammar:

$(selector).toggle(speed,callback)

Hide the selected elements if they are visible, and show them if they are hidden.

.slideUp() hides the selected element by using the sliding effect, if the element is already shown.

grammar:

$(selector).slideUp(speed,callback)

 .slideDown() The curtain effect expands; dynamically displays all matching elements by height changes (increases downwards), optionally triggering a callback function when the display is complete. The callback function is optional, and the speed also has the three predetermined speeds above, or it can be a numerical value

 

*.slideDown(speed, [callback])

 Take a small example:

Put the mouse on "Hide" to hide the p tag, and put it on "Show" to display the hidden content

<!DOCTYPE html>
<html>
<head>
<script src="/jquery/jquery-1.11.1.min.js"></script>
<script type="text/javascript">
$(document).ready(function(){
  $("#hide").mouseenter(function(){
  $("p").hide();
  });
  $("#show").mouseleave(function(){
  $("p").show();
  });
});
</script>
</head>
<body>
<p id="p1">I disappear if the mouse is over the "Hide" button. </p>
<a id="hide" type="button">隐藏</a>
<a id="show" type="button">显示</a>
</body>
</html>

 

 

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326891594&siteId=291194637