Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on May 9th, 2012  |  syntax: None  |  size: 0.54 KB  |  hits: 12  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. How to check Checkbox with Jquery
  2. for(var i = 0, len = data.UserDetail.RoleNames.length; i < len; ++i) {
  3.     var rolevalue = data.UserDetail.RoleNames[i];
  4.     //alert(rolevalue)
  5.  
  6.     $('input[value = rolevalue]').attr('checked', true); // I am getting a exception in this line !! :(
  7. }
  8.        
  9. <input type="checkbox" name="role" value="Admin1" />Admin1<br />
  10. <input type="checkbox" name="role" value="Admin2" />Admin2<br />
  11. <input type="checkbox" name="role" value="Admin3" />Admin3<br />
  12.  
  13. <input type="checkbox" name="role" value="Admin4" />Admin4<br />