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">Click here</button> <hr> <textarea></textarea> <h2></h2> <script> $(document).ready(function(){ $("button").click(function(){ $("textarea").focus(); }); $("textarea").focus(function(){ $("h2").html("Sự kiện focus() vừa xảy ra trên TEXTAREA"); }); }); </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">Click here</button> <hr> <textarea></textarea> <h2></h2> <script> $(document).ready(function(){ $("button").click(function(){ $("textarea").focus(); }); $("textarea").focus(function(){ $("h2").html("Sự kiện focus() vừa xảy ra trên TEXTAREA"); }); }); </script> </body> </html>