javascript - how to check the check box with dynamic Ids using jquery -
i having check-box 1 name. every check-box have dynamic name ids.
if click name automatically check-box should checked. not happening in code. tried many ways.
my code here:
var checkboxid = nameid; // fetch name id. //$('#' + checkboxid).attr('checked', true); $('#checkboxid').prop('checked', true);
html code:
<%: html.checkbox("name" + item.id.tostring(), new { id = item.id, @class = "names" })%>
please me how process?
actually html code gave wrong
<%: html.checkbox("name" + item.id.tostring(), new { @id = item.id, @class = "names" })%>
my jquery code:
var divid = "#" + name; $(divid).attr('checked', true);
Comments
Post a Comment