Setting checkbox input when specific value equals variable in jquery -
i trying use jquery set checkbox checked if input value of checkbox equal other variable have. code looks like:
var test_val = "test"; $('#checkbox[value='+test_val+']').attr('checked', true);
this not seem working, help
try this
$('#checkbox[value="'+test_val+'"]').attr('checked', true);
you missing quotes around value.
Comments
Post a Comment