jQuery click()
The jQuery click () method is executed once the click event occurs. Syntax: To trigger the click event for the selected elements. $(selector).click() To attach a function to the click event. Example1: <!DOCTYPE html> <html> <head> <script src=”https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js”></script> <script> $(document).ready(function(){ $(“h1,h2”).click(function(){ $(this).hide(); }); }); </script> </head> <body> <h1>Click me. I am a ghost.</h1> <h2>Me too.</h2> … Read more