Sublime Text
<!DOCTYPE html> <html> <head> <script src="http://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.12.0.min.js"></script> </head> <body> <button type="button" id="button1">Click here 1</button> <hr> <button type="button" id="button2">Click here 2</button> <script> $(document).ready(function(){ $("#button1").click(function(){ $("#button2").click(); }); $("#button2").click(function(){ alert("Sự kiện click() vừa mới xảy ra trên phần tử #button2!"); }); }) </script> </body> </html>
<!DOCTYPE html> <html> <head> <script src="http://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.12.0.min.js"></script> </head> <body> <button type="button" id="button1">Click here 1</button> <hr> <button type="button" id="button2">Click here 2</button> <script> $(document).ready(function(){ $("#button1").click(function(){ $("#button2").click(); }); $("#button2").click(function(){ alert("Sự kiện click() vừa mới xảy ra trên phần tử #button2!"); }); }) </script> </body> </html>