Jquery show() and hide()

Jquery hide()
This method is used to hide the HTML elements.
$(document).ready(function(){
  $('#hide').click(function(){
    $('p').hide();
  });
}); 


Jquery show()
This method is used to show the HTML elements.
$(document).ready(function(){
  $('#show').click(function(){
    $('p').show();
  });
}); 


Jquery toggle()
This method toggles between hide() and show().
$(document).ready(function(){
  $('button').click(function(){
    $('p').toggle();
  });
}); 


Syntax
$(selector).hide(speed,callback);
$(selector).show(speed,callback); 
$(selector).toggle(speed,callback);


Code Structure:
$(document).ready(function(){
  $('#hide').click(function(){
    $('p').hide(500);
  });
}); 


Code Structure
$(document).ready(function(){
  $('button').click(function(){
    $('p').toggle(fast);
  });
}); 

Share this

Related Posts