HTML Editor
<!DOCTYPE html> <html lang="en-US"> <head> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script> </head> <body> <h1>jQuery click() Method</h1> <p>Select the text in the input to trigger button click.</p> <input type="text" value="select me"> <button>Click Me</button> <script> $(document).ready(function(){ $("button").click(function(){ alert("button clicked"); }); $("input").select(function(){ $("button").click(); }); }); </script> </body> </html>
OUTPUT
×

Save as Private