//Check Items by value var selValue = [1, 2, 4]; var $ctrls = $("[id*=CheckBoxList1]"); for (var i = 0; i < selValue.length; i++) { $ctrls.find('input:checkbox[value=' + selValue[i] + ']').prop('checked', true); } |
Thursday, April 23, 2015
ASP.NET CheckBoxList Operations with jQuery - Check Items By Value:
ASP.NET CheckBoxList Operations with jQuery - Check Items By Index
//Check Items by index var selIndex = [0, 2, 3]; for (var i = 0; i < selIndex.length; i++) { $("[id*=CheckBoxList1] input:checkbox").eq(selIndex[i]).prop('checked', true); }ASP.NET CheckBoxList Operations with jQuery - Check/Uncheck All Checkboxes
$("[id*=CheckBoxList1] input:checkbox").prop('checked',true); //To check all$("[id*=CheckBoxList1] input:checkbox").prop('checked',false);// To uncheck all |
ASP.NET CheckBoxList Operations with jQuery - Get Text of Selected Items
$("[id*=CheckBoxList1] input:checked").each(function () { alert($(this).next().html()); });ASP.NET CheckBoxList Operations with jQuery - Get Index of selected items
var $ctrls = $("[id*=CheckBoxList1] input:checkbox"); $("[id*=CheckBoxList1] input:checked").each(function () { alert($ctrls.index($(this))); });
Subscribe to:
Comments (Atom)