从checkboxlist中设置复选框以使用jquery取消选中 [英] set checkbox from checkboxlist to uncheck using jquery
问题描述
如何从asp.net checkboxlist控件设置一个复选框,取消选中所选复选框的索引是i使用jquery。
如果我理解你,你应该可以做类似的事情:
$('input:checkbox') .EQ(ⅰ).removeAttr( '检查');
要进行设置,您可以使用:
< 。pre>
$( '输入:复选框')当量(ⅰ).attr( '检查', '检查');
请注意,初始选择器将获取页面上的所有复选框。如果您需要将其限制为页面上的一个复选框子集,请根据容器或复选框的命名方案调整初始选择器 - 仅处理相关的复选框。我还假设您正在使用基于零的索引来查看相关的复选框。
how to set one checkbox from asp.net checkboxlist control to unchecked where the index of the selected check box is i using jquery.
If I understand you, you should be able to do something like:
$('input:checkbox').eq(i).removeAttr('checked');
To set it, you would use:
$('input:checkbox').eq(i).attr('checked','checked');
Note that the initial selector will get all the checkboxes on the page. If you need to restrict it to just a subset of checkboxes on the page, adjust the initial selector -- based on a container or the naming scheme for the checkboxes - to deal with just the checkboxes in question. I'm also assuming that you're using zero-based indexing for the checkbox in question.
这篇关于从checkboxlist中设置复选框以使用jquery取消选中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!