javascript - How to get the value of custom HTML attribute using JQuery? -
i have repeater check boxes in each row. i'm trying check check box in row based on check box in same row. i'm executing function on onclick event of check box , function finds custom attribute of parent , checks if parent checked or not. if returned true checks check box same attribute name child class . th problem can't value of custom attribute of parent class. undefined.
childid in jquery function undefined. tried using data property it's of no use .
$(objid).data('chldname'); function check_view(objid) { var childid = $(objid).attr('chldname'); if ($(objid).is(':checked')) { $("[name=" + childid + "]").attr('checked', true); } }
html:
<td style="text-align: center"> <asp:checkbox id="cb_uploadaccess" runat="server" chldname='chld<%#eval("role_seq")%>' onclick='javascript:return check_view(this);' /> <asp:hiddenfield id="hiddenuploadaccess" runat="server" value='<%#eval("upload_access")%>' /> </td> <td style="text-align: center"> <asp:checkbox id="cb_viewaccess" name='chld<%#eval("role_seq")%>' runat="server" /> <asp:hiddenfield id="hiddenviewaccess" runat="server" value='<%#eval("view_access")%>' /> </td>
create data-chldname attribute , access using
$(objid).attr('data-chldname')
Comments
Post a Comment