Wednesday, 21 September 2011

How to change color on focus of input box using jquery?

Hi Dear,

<script src=""></script>
.focused {
    background: #abcdef;
<form name="focusForm" id="focusForm" method="POST" >
<table width="100%" cellspacing="2" cellpadding="2" >
        <td width="180">First Name: </td>
        <td><input type="text" name="txtFName" value="" /></td>
        <td>Last Name: </td>
        <td><input type="text" name="txtLName" value="" /></td>
        <td>Age: </td>
        <td><input type="text" name="txtAge" value="" /></td>
        <td>Occupation: </td>
        <td><input type="text" name="txtOccupation" value="" /></td>
        <td>Secret Question: </td>
        <td><input type="text" name="txtQuestion" value="" /></td>
        <td>Answer: </td>
        <td><input type="text" name="txtAnswer" value="" /></td>
//$("#focusForm input:first").focus();
//$("#focusForm :input").attr('disabled','disabled');
$("#focusForm :input").live("focus blur", function(e) {
    var el = $(this);


1 comment: