2013-10-24 16:05
浏览 82


When loading a set of input fields dynamically with a PHP For clause, I want to have a checkbox for each of the rows so in case the user checks it, all input fields for that particular row will get disabled.

I need to dynamically adapt the javascript so it will disable each particular row every time the corresponding checkbox is clicked but I don't really know how to achieve it.

Here is my code:

for ($i=0;$i<5;$i++)
   <td><input id="includeItem<?=$i?>" type="checkbox" onchange="includeMore" name="item<?=$i?>"></td>
   <td><input name="id<?=$i?> style="color:#888;" disabled="disabled"></td>
   <td><input id="formItems<?=$i?>" class="datepicker" name="date<?=$i?>"></td>
   <td><input id="formItems<?=$i?>" name="description<?=$i?>"></td>
   <td><input id="formItems<?=$i?>" name="amount<?=$i?>"></td>
<?php } ?>

Then my javascript is as follows:

    function includeMore()  {
        var $check = $('#includeItem');
            else {


1条回答 默认 最新

相关推荐 更多相似问题