Sublime Text
<!DOCTYPE html> <html> <head> <script src="http://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.12.0.min.js"></script> <script> $(document).ready(function(){ $("div").focusin(function(){ $(this).css("background-color", "green"); }); $("div").focusout(function(){ $(this).css("background-color", "white"); }); }); </script> </head> <body> <div style="border: 1px solid gray;padding:15px;"> Họ tên: <input type="text"><br><br> Giới tính: <input type="text"> </div> <p>Click vào phần tử input để xem kết quả</p> </body> </html>
<!DOCTYPE html> <html> <head> <script src="http://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.12.0.min.js"></script> <script> $(document).ready(function(){ $("div").focusin(function(){ $(this).css("background-color", "green"); }); $("div").focusout(function(){ $(this).css("background-color", "white"); }); }); </script> </head> <body> <div style="border: 1px solid gray;padding:15px;"> Họ tên: <input type="text"><br><br> Giới tính: <input type="text"> </div> <p>Click vào phần tử input để xem kết quả</p> </body> </html>