Javascript examples for jQuery:CSS
Focus div to apply CSS style
<html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <script type="text/javascript" src="https://code.jquery.com/jquery-1.7.1.js"></script> <style id="compiled-css" type="text/css"> input {/*from w w w. jav a 2 s.c o m*/ width: 100px; height: 100px; } </style> <script type="text/javascript"> $(window).load(function(){ $('input').focus(function() { $(this).css('background','green'); }); }); </script> </head> <body> <input> </body> </html>