twitter bootstrap - selecting dynamic checkbox by name...jQuery -
i'm using bootstrap table checkboxes. html rendered follows:
<td class="bs-checkbox"> <input data-index="0" name="btselectitem" type="checkbox"> </td> <td class="bs-checkbox"> <input data-index="1" name="btselectitem" type="checkbox"> </td> when user checks 1 of boxes, want event fired trap it. how i'm trying so, no avail:
$('table').on('click', 'input[name=btselectitem]', function (index, obj){ alert(obj); }); the data coming ajax call, dynamic. how fire code when user clicks on 1 of checkboxes? thanks
you going right way, u_mulder suggested, if table dynamic too, use element, maybe document
$(document).on('click', 'input[name=btselectitem]', function (){ alert($(this).attr('data-index')); // suppose index needed, not sure of obj });
Comments
Post a Comment