How to toggle HTML tag with jQuery

1 Answer

0 votes
<html>
 <head>
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
    <script>
      $(document).ready(function(){
        $("button").click(function(){
          $("h1").toggle();
        });
      });
    </script>
 </head>
 <body>
   <h1>Toggle Text</h1>
   <button>Click to toggle</button>
 </body>
</html>

 



answered Mar 1, 2021 by avibootz

Related questions

2 answers 281 views
1 answer 274 views
3 answers 396 views
1 answer 291 views
...