Enable checkboxlist not working in IE, asp.net, jquery -
<asp:checkboxlist id="chklist" runat="server" enabled="false" > <asp:listitem text="1" value="1"></asp:listitem> <asp:listitem text="2" value="2"></asp:listitem> </asp:checkboxlist> <asp:button id="btnfoo" runat="server" text="test" /> <script type="text/javascript" language="javascript"> $(document).ready(function () { $('#<% = btnfoo.clientid %>').click(function () { //var targetvalue = 2; var items = $('#<% = chklist.clientid %> input:checkbox'); (var = 0; < items.length; i++) { //alert(i); //if (items[i].value == targetvalue) { items[i].checked = true; // break; //} } $('#<%= chklist.clientid%>input:checkbox').removeattr('disabled'); return false; }) }); </script>
note: works in chrome, ff not in ie
its not wroking in ie8, here below code. checking checkboxes, keeps them disabled, solution please?
try using prop
property instead of .checked
:
$("#btn").on("click",function(){ $('input:checkbox').each(function(){ $(this).prop("checked", "true"); }); });
jsfiddle: http://jsfiddle.net/hxs7m/1/
edit: make them enabled.
$("#btn").on("click",function(){ $('input:checkbox').each(function(){ $(this).prop("checked", "true").prop("disabled",false); }); });
jsfiddle: http://jsfiddle.net/hxs7m/4/
Comments
Post a Comment