Check checkbox checked property using jQuery
Posted
by
Prasad
on Stack Overflow
See other posts from Stack Overflow
or by Prasad
Published on 2009-05-23T15:16:39Z
Indexed on
2012/12/10
5:04 UTC
Read the original article
Hit count: 144
I need to check the checked
property of a checkbox and perform an action based on the checked property using jQuery.
For example, if the age checkbox is checked, then I need to show a textbox to enter age, else hide the textbox.
But the following code returns false
by default:
if($('#isAgeSelected').attr('checked')) {
$("#txtAge").show();
} else {
$("#txtAge").hide();
}
How do I successfully query the checked
property?
© Stack Overflow or respective owner