Tuesday, May 27, 2014

jQuery hide() and show()

Syntax:

$(selector).hide(speed,callback);

$(selector).show(speed,callback);

callback : The optional callback parameter is a function to be executed after the hide() or show() method completes

speed : The optional speed parameter specifies the speed of the hiding/showing, and can take the following values: "slow", "fast", or milliseconds.

$("button").click(function(){
  $("p").hide(1000);
});

$("#hide").click(function(){
  $("p").hide();
});

$("#show").click(function(){
  $("p").show();
});

No comments:

Post a Comment