I have a Gridview, each row with two check box, on the check of second checkbox i want the first check box to be checked automatically.I'm looking for Clent side scripts...Please help
1 Answer
Try this
var rows = $("#your table tr:gt(0)"); // skip the header row
rows.each(function(index) {
var lastCheckbox = $("td:nth-child(youlast checkbox cell) input", this);
var firstCheckBox=$("td:nth-child(firstCheckboxCellIndex) input", this);
$(lastCheckbox).change(function(e) { $(firstCheckBox).attr('checked',$(this).is(':checked'));
});;
1 Comment
nkg
hi i chnaged the code like this $(document).ready(function () { var rows = $("#GrdMenuConfig tr:gt(0)"); rows.each(function (index) { var lastCheckbox = $("td:nth-child(4) input", this); var firstCheckBox = $("td:nth-child(3) input", this); $(lastCheckbox).change(function (e) { $(firstCheckBox).attr('checked', $(this).is(':checked')); }); }); }); but it doesn'tworks...!!