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

Popular posts from this blog

Magento/PHP - Get phones on all members in a customer group -

php - Bypass Geo Redirect for specific directories -

php - .htaccess mod_rewrite for dynamic url which has domain names -