jQuery toggle()

Toggling between the hide() and show() methods can be done easily using the jQuery toggle() method. This type of animation is often used in jQuery projects. toggle() method is used to toggle the selected elements. Example: <!DOCTYPE html> <html> <head> <script src=”https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js”></script> <script> $(document).ready(function(){ $(“button”).click(function(){ $(“div”).toggle(); }); }); </script> </head> <body> <div style=”background: red; height: … Read more