I want to check if a certain check box is selected using JavaScript/jQuery.
Here is the code I tried:
var a;
if ($("#add_desc").checked == 1){
a = "true";
}else{
a= "false";
}
I have also tried:
var a;
if ($("#add_desc").checked){
a= "true";
}else{
a= "false";
}
It always returns false once I alert the variable a
.
Any idea why it won't work for me? Am I doing it wrong?
Thanks!
No comments:
Post a Comment