samedi 20 février 2016

combobox change checkbox enable

I have an issue with my javascript. When I change combobox all of the checkbox enable. I don't it like that. I want only each checkbox enable not all of them. Here is my js code:

<script>
  function activ(){
     $("input[type='checkbox']").removeAttr("disabled");
  }
</script>
<script>
  function disable(){
     $("input[type='checkbox']").attr("disabled", "disabled");
  }
</script>

And here is my HTML code:

<html>
   <body onload="disable();">
      <table>
         <tr>
            <th>SELECT</th>
            <th>TAKE</th>
         </tr>
         <tr>
            <td>
                 <select onchange="activ();">
                     <option>--Select--</option>
                     <option>Cars</option>
                     <option>Plane</option>
                     <option>Boat</option>
                 </select>
            </td>
            <td><input type="checkbox" name="check1" /></td>
         </tr>
            <tr>
            <td>
                 <select onchange="activ();">
                     <option>--Select--</option>
                     <option>Cars</option>
                     <option>Plane</option>
                     <option>Boat</option>
                 </select>
            </td>
            <td><input type="checkbox" name="check1" /></td>
          </tr>
            <tr>
            <td>
                 <select onchange="activ();">
                     <option>--Select--</option>
                     <option>Cars</option>
                     <option>Plane</option>
                     <option>Boat</option>
                 </select>
            </td>
            <td><input type="checkbox" name="check1" /></td>
        </tr>
   </body>
</html>

I hope any body can help me. I really appreciate for any help.. Thanks




Aucun commentaire:

Enregistrer un commentaire