jquery - Iterate asp.net checkbox, if any one is checked then unchecheck the checkbox with ID="All" -


html

 <div>     <asp:checkbox id="all" runat="server" checked="true" text="all" forecolor="black" /><br />     <asp:checkbox id="checkbox2" runat="server" text="accepted" forecolor="black" cssclass="chkdisplay" /><br />     <asp:checkbox id="checkbox3" runat="server" text="contacted" forecolor="black" cssclass="chkdisplay"  /><br />     <asp:checkbox id="checkbox4" runat="server" text="pending" forecolor="black" cssclass="chkdisplay" /><br />     <asp:checkbox id="checkbox5" runat="server" text="pre-authorized" forecolor="black" cssclass="chkdisplay" /><br />     <asp:checkbox id="checkbox6" runat="server" text="show deleted" forecolor="black" cssclass="chkdisplay" /><br />     <asp:checkbox id="checkbox7" runat="server" text="treated" forecolor="black" cssclass="chkdisplay" /> </div> 

script tried(its not working).i have used asp.net checkbok , cssclass iterate through think cssclass not work class selector:

$(document).ready(function () {     $('.chkdisplay').each(function () {         if ($(this).is(':checked')) {             $('#all').attr('checked', false);         }     }); }); 

is there way wand use asp.net checkbox only.when select checkbok between 2 7 want checkbok of id="all" unchecked
thank u

pay attention: cssclass not apply input element span wraps input element. should iterate each first children of .chkdisplay elements (see here).

something like:

$('.chkdisplay > input').each(function () {     if (this.checked) {         $('#all').prop('checked', false);         return false;     } }); 

Comments

Popular posts from this blog

jquery - How can I dynamically add a browser tab? -

node.js - Getting the socket id,user id pair of a logged in user(s) -

keyboard - C++ GetAsyncKeyState alternative -