Home How to check whether a checkbox is checked in jQuery?
Reply: 0

How to check whether a checkbox is checked in jQuery?

user539
1#
user539 Published in February 25, 2018, 5:23 pm

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?

You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.77959 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO