I have the following piece of code :
for(var i = 0, len = data.UserDetail.RoleNames.length; i < len; ++i) {
var rolevalue = data.UserDetail.RoleNames[i];
//alert(rolevalue)
$('input[value = rolevalue]').attr('checked', true); // I am getting a exception in this line !! :(
}
I am not able to check the values which are already present in the checkbox. The checkbox is having the following value
<input type="checkbox" name="role" value="Admin1" />Admin1<br />
<input type="checkbox" name="role" value="Admin2" />Admin2<br />
<input type="checkbox" name="role" value="Admin3" />Admin3<br />
<input type="checkbox" name="role" value="Admin4" />Admin4<br />
What will be syntax? I have also tried using the prop() function as well but it does not work.