sudhakarinfotech
(current)
Run Code
Live Code Editor- jQuery Hide Show
Source Code
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>jQuery Show And Hide Effects</title> <script src="https://code.jquery.com/jquery-3.5.1.min.js"></script> <style> p{ padding:20px; background: green; color:white; font-size:25px; } .btn-show-effect,.btn-hide-effect{ padding:10px 15px; background-color:black; color:white; border:none; border-radius:5px; margin:15px 10px; } </style> <script> $(document).ready(function(){ // Hide displayed paragraphs $(".btn-hide-effect").click(function(){ $("p").hide(); }); // Show hidden paragraphs $(".btn-show-effect").click(function(){ $("p").show(); }); }); </script> </head> <body> <h1>jQuery Effect</h1> <button type="button" class="btn-show-effect">Show Paragraphs</button> <button type="button" class="btn-hide-effect">Hide Paragraphs</button> <p>This is first paragraph.</p> <p>This is second paragraph.</p> </body> </html>
Source Code Output :
Running