Skip to content

Onmouse hover event change color of textbox in jquery

<html>
<head>
<meta http-equiv=”Content-type” content=”text/html; charset=utf-8″ />
<title>jQuery test</title>

<style>
body {font-family:arial;}
</style>
<head>
 <script src=”https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js” type=”text/javascript”></script>
 <script type=”text/javascript”>
 //runs once page is loaded and ready to be manipulated
    $(document).ready(function(){
        $(‘#first-name’).bind(‘focus’, function(){
            $(this).css(‘border’,’1px solid red’);
        });
        $(‘#first-name’).bind(‘blur’, function(){
            $(this).css(‘border’,’1px solid blue’);
        });       
        });
   
 </script>
</head>
<body>   
    <input type=”text” name=”firstname” id=”first-name” />
    </body>
</html>

Tags: