Sublime Text
<!DOCTYPE html> <html> <head> <script src="http://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.12.0.min.js"></script> </head> <body> <input type="text"> <textarea></textarea> <select> <option value="cantho">Cần Thơ</option> <option value="vinhlong">Vĩnh Long</option> <option value="soctrang">Sóc Trăng</option> </select> <h2></h2> <script> $(document).ready(function(){ $("input").focus(function(){ $("h2").html("Sự kiện focus() vừa xảy ra trên INPUT"); }); $("textarea").focus(function(){ $("h2").html("Sự kiện focus() vừa xảy ra trên TEXTAREA"); }); $("select").focus(function(){ $("h2").html("Sự kiện focus() vừa xảy ra trên SELECT"); }); }); </script> </body> </html>
<!DOCTYPE html> <html> <head> <script src="http://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.12.0.min.js"></script> </head> <body> <input type="text"> <textarea></textarea> <select> <option value="cantho">Cần Thơ</option> <option value="vinhlong">Vĩnh Long</option> <option value="soctrang">Sóc Trăng</option> </select> <h2></h2> <script> $(document).ready(function(){ $("input").focus(function(){ $("h2").html("Sự kiện focus() vừa xảy ra trên INPUT"); }); $("textarea").focus(function(){ $("h2").html("Sự kiện focus() vừa xảy ra trên TEXTAREA"); }); $("select").focus(function(){ $("h2").html("Sự kiện focus() vừa xảy ra trên SELECT"); }); }); </script> </body> </html>