Sometimes we need to hide/Unhide some part of a webpage from the client side depending on Input.

This can be done using various client side scripting.T oday ,we will do that using Jquerry

  1. <!doctype html>
  2. <html>
  3. <head>
  4. <title>How to hide/show an element using jQuery show/hide effects</title>
  5. </head>
  6. <body>
  7. <input type="button" value="Hide Box" class="button-hide" />
  8. <input type="button" value="Show Box" class="button-show" />
  9. <div id="box">Box</div>
  10. <script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
  11. <script src="//ajax.googleapis.com/ajax/libs/jqueryui/1.10.3/jquery-ui.min.js"></script>
  12. <script>
  13. $(document).ready(function() {
  14. $('.button-show').click(function(){
  15. $("#box").show();
  16. });
  17. $('.button-hide').click(function(){
  18. $("#box").hide();
  19. });
  20. });
  21. </script>
  22. </body>
  23. </html>