0
votes

i tried to identify dynamically create check box using this code.when i checked check box it give correct value but i checked 2 check box and unchecked one but cant identify what i checked or not....

<tbody data-bind="foreach: customers" id="tbody_tr">
    @*   <tr style="border: solid" data-bind="click: $root.setSelectedUser" id="updtr">*@
        <tr style="border: solid" id="updtr">
           <td><input class="userckselectedbox" type="checkbox" data-bind="event:{checked: $root.selectedUserNames }" /></td>
            <td><span data-bind="text: ID"></span></td>
            <td><span data-bind="text: Name"></span></td>
            <td><span data-bind="text:Dateofbirth"></span></td>  
            <td><label data-bind="click:$root.setSelectedUser">ok</label></td>                          
        </tr>
    </tbody>

strong text

self.selectedUserNames = function getdata(user)
        {

            alert(user.Name);
        }
1
ok... when i checked check box in my table i want pop up data only for particular check box. but problem is firstly i checked 1st check box and i can pop data and again i checked 2 rd check box and i can popup data again i unchecked 2 check box.how to identify 1 st check box checked or nor??? - Aruna Madushan

1 Answers

4
votes

I have created a fiddle according to your requirement. Check this:

Working fiddle.

Let me know if this helps!