jquery focus and blur not working

jquery focus and blur not working

I cannot seems to find an answer why jquery is not working. please see codes.


  1. <script src="http://code.jquery.com/jquery-1.10.1.min.js"></script>
  2. <script src="http://code.jquery.com/jquery-migrate-1.2.1.min.js"></script>
  3.    <script type="text/javascript" language="javascript">
  4.    <style type="text/css">
    .holder {
        border-top-style: none;
        border-right-style: none;
        border-bottom-style: none;
        border-left-style: none;
    }
    body,td,th {
        font-family: Arial, Helvetica, sans-serif;
        font-size: 12px;
    }

    input{
        background:#FFFFEE;
    }
    .red{
        background-color:red;
    }
    </style>

















  5.     $('input:text').bind('focus blur', function() {
  6.         $(this).toggleClass('red');
  7.     });
  8.   </script>
  9. </head>

HTML



  1. <form id="form1" name="form1" method="post" action="">
  2.   <p>&nbsp;</p>
  3.   <table width="829" border="1" align="center" class="holder">
  4.     <tr>
  5.       <td width="889"><p>&nbsp;</p>
  6.         <table width="759" height="291" border="0" align="center">
  7.           <tr>
  8.             <td colspan="7">Pawnshop </td>
  9.           </tr>
  10.           <tr>
  11.             <td colspan="7" bgcolor="#009900"><div align="center">Pawn Reference</div></td>
  12.           </tr>
  13.           <tr>
  14.             <td colspan="2" rowspan="6"><div align="center"><img src="../images/ticket-1-icon.png" width="64" height="64" /></div></td>
  15.             <td width="144" height="26"><label for="textfield17"></label>
  16.             Serial No.:</td>
  17.             <td width="144">&nbsp;</td>
  18.             <td width="146">Pawn Ticket:</td>
  19.             <td width="40">&nbsp;</td>
  20.             <td width="69">&nbsp;</td>
  21.           </tr>
  22.           <tr>
  23.             <td height="23"><input type="text" name="textfield" id="textfield17" /></td>
  24.             <td>&nbsp;</td>
  25.             <td><input type="text" name="textfield2" id="textfield18"  /></td>
  26.             <td>&nbsp;</td>
  27.             <td>&nbsp;</td>
  28.           </tr>
  29.           <tr>
  30.             <td>Date loan granted</td>
  31.             <td>&nbsp;</td>
  32.             <td>Maturity Date:</td>
  33.             <td>&nbsp;</td>
  34.             <td>&nbsp;</td>
  35.           </tr>
  36.           <tr>
  37.             <td><input type="text" name="textfield3" id="textfield19"  /></td>
  38.             <td>&nbsp;</td>
  39.             <td><input type="text" name="textfield4" id="textfield20" /></td>
  40.             <td>&nbsp;</td>
  41.             <td>&nbsp;</td>
  42.           </tr>
  43.           <tr>
  44.             <td height="23">&nbsp;</td>
  45.             <td>&nbsp;</td>
  46.             <td>Expiry Date of Redemption</td>
  47.             <td>&nbsp;</td>
  48.             <td><label for="textfield20"></label></td>
  49.           </tr>
  50.           <tr>
  51.             <td height="26">&nbsp;</td>
  52.             <td>&nbsp;</td>
  53.             <td><input type="text" name="textfield5" id="textfield21" /></td>
  54.             <td>&nbsp;</td>
  55.             <td><label for="textfield21"></label></td>
  56.           </tr>
  57.           <tr>
  58.             <td colspan="7" bgcolor="#009900"><div align="center">Client Information</div></td>
  59.           </tr>
  60.           <tr>
  61.             <td>&nbsp;</td>
  62.             <td>&nbsp;</td>
  63.             <td><label for="select2"></label></td>
  64.             <td>&nbsp;</td>
  65.             <td>&nbsp;</td>
  66.             <td colspan="2" rowspan="7"><label for="textfield26"><img src="../images/user-group-icon.png" width="128" height="128" /></label></td>
  67.           </tr>
  68.           <tr>
  69.             <td>&nbsp;</td>
  70.             <td>Salutation</td>
  71.             <td>Surname</td>
  72.             <td>Firstname</td>
  73.             <td>Middle Name</td>
  74.           </tr>
  75.           <tr>
  76.             <td>&nbsp;</td>
  77.             <td><div align="right">
  78.               <select name="select" id="select2">
  79.                 <option>Select</option>
  80.                 <option value="Mr">Mr</option>
  81.                 <option value="Ms">Ms</option>
  82.                 <option value="Mrs">Mrs</option>
  83.               </select>
  84.             </div></td>
  85.             <td><label for="textfield22"></label>
  86.               <input type="text" name="textfield6" id="textfield22"/></td>
  87.             <td><label for="textfield23"></label>
  88.               <input type="text" name="textfield7" id="textfield23" /></td>
  89.             <td><label for="textfield24"></label>
  90.               <input type="text" name="textfield8" id="textfield24" /></td>
  91.           </tr>
  92.           <tr>
  93.             <td>&nbsp;</td>
  94.             <td>&nbsp;</td>
  95.             <td colspan="3">Complete Address</td>
  96.           </tr>
  97.           <tr>
  98.             <td>&nbsp;</td>
  99.             <td>&nbsp;</td>
  100.             <td colspan="3"><label for="textfield25"></label>
  101.               <input type="text" name="textfield9" id="textfield25" size="69" /></td>
  102.           </tr>
  103.           <tr>
  104.             <td>&nbsp;</td>
  105.             <td>&nbsp;</td>
  106.             <td>Contact No.</td>
  107.             <td>ID Presented</td>
  108.             <td>Email Address</td>
  109.           </tr>
  110.           <tr>
  111.             <td>&nbsp;</td>
  112.             <td>&nbsp;</td>
  113.             <td><input type="text" name="textfield14" id="textfield26" /></td>
  114.             <td><label for="textfield27"></label>
  115.               <input type="text" name="textfield15" id="textfield27" /></td>
  116.             <td><label for="textfield28"></label>
  117.               <input type="text" name="textfield16" id="textfield28" /></td>
  118.           </tr>
  119.           <tr>
  120.             <td>&nbsp;</td>
  121.             <td>&nbsp;</td>
  122.             <td>&nbsp;</td>
  123.             <td>&nbsp;</td>
  124.             <td>&nbsp;</td>
  125.             <td>&nbsp;</td>
  126.             <td>&nbsp;</td>
  127.           </tr>
  128.           <tr>
  129.             <td colspan="7" bgcolor="#009900"><div align="center">Pawn Item Information</div></td>
  130.           </tr>
  131.           <tr>
  132.             <td>&nbsp;</td>
  133.             <td>&nbsp;</td>
  134.             <td>&nbsp;</td>
  135.             <td>&nbsp;</td>
  136.             <td>&nbsp;</td>
  137.             <td>&nbsp;</td>
  138.             <td>&nbsp;</td>
  139.           </tr>
  140.           <tr>
  141.             <td>&nbsp;</td>
  142.             <td>&nbsp;</td>
  143.             <td>Description of the Pawn</td>
  144.             <td>&nbsp;</td>
  145.             <td>&nbsp;</td>
  146.             <td>&nbsp;</td>
  147.             <td>&nbsp;</td>
  148.           </tr>
  149.           <tr>
  150.             <td>&nbsp;</td>
  151.             <td>&nbsp;</td>
  152.             <td colspan="3"><textarea name="textarea" id="textarea2" cols="40" rows="5" ></textarea></td>
  153.             <td>&nbsp;</td>
  154.             <td>&nbsp;</td>
  155.           </tr>
  156.           <tr>
  157.             <td>&nbsp;</td>
  158.             <td>&nbsp;</td>
  159.             <td>&nbsp;</td>
  160.             <td>&nbsp;</td>
  161.             <td>&nbsp;</td>
  162.             <td>&nbsp;</td>
  163.             <td>&nbsp;</td>
  164.           </tr>
  165.           <tr>
  166.             <td>&nbsp;</td>
  167.             <td>&nbsp;</td>
  168.             <td>Principal</td>
  169.             <td><label for="textfield29"></label>
  170.               <input type="text" name="textfield10" id="textfield29" placeholder="0.00" /></td>
  171.             <td>&nbsp;</td>
  172.             <td>&nbsp;</td>
  173.             <td>&nbsp;</td>
  174.           </tr>
  175.           <tr>
  176.             <td>&nbsp;</td>
  177.             <td>&nbsp;</td>
  178.             <td>Interest</td>
  179.             <td><label for="textfield30"></label>
  180.               <input type="text" name="textfield11" id="textfield30" placeholder="0.00" /></td>
  181.             <td>&nbsp;</td>
  182.             <td>&nbsp;</td>
  183.             <td>&nbsp;</td>
  184.           </tr>
  185.           <tr>
  186.             <td>&nbsp;</td>
  187.             <td>&nbsp;</td>
  188.             <td>Service Charge</td>
  189.             <td><label for="textfield31"></label>
  190.               <input type="text" name="textfield12" id="textfield31" placeholder="0.00" /></td>
  191.             <td>&nbsp;</td>
  192.             <td>&nbsp;</td>
  193.             <td>&nbsp;</td>
  194.           </tr>
  195.           <tr>
  196.             <td>&nbsp;</td>
  197.             <td>&nbsp;</td>
  198.             <td>Net Proceeds</td>
  199.             <td><label for="textfield32"></label>
  200.               <input type="text" name="textfield13" id="textfield32" placeholder="0.00" /></td>
  201.             <td>&nbsp;</td>
  202.             <td>&nbsp;</td>
  203.             <td>&nbsp;</td>
  204.           </tr>
  205.           <tr>
  206.             <td>&nbsp;</td>
  207.             <td>&nbsp;</td>
  208.             <td>&nbsp;</td>
  209.             <td>&nbsp;</td>
  210.             <td>&nbsp;</td>
  211.             <td>&nbsp;</td>
  212.             <td>&nbsp;</td>
  213.           </tr>
  214.           <tr>
  215.             <td>&nbsp;</td>
  216.             <td>&nbsp;</td>
  217.             <td>&nbsp;</td>
  218.             <td>&nbsp;</td>
  219.             <td><input type="submit" name="button" id="button" value="Continue &gt;&gt;&gt;" /></td>
  220.             <td>&nbsp;</td>
  221.             <td>&nbsp;</td>
  222.           </tr>
  223.         </table>
  224.         <p>&nbsp;</p>
  225.       <p>&nbsp;</p>
  226.       <p>&nbsp;</p></td>
  227.     </tr>
  228.   </table>
  229.   <p>&nbsp;</p>
  230. </form>

please help. thanks