How do I check whether a checkbox is checked in jQuery?

前端 未结 30 3437
花落未央
花落未央 2020-11-21 04:44

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

30条回答
  •  无人共我
    2020-11-21 05:02

    The top answer didn't do it for me. This did though:

    
    

    Basically when the element #li_13 is clicked, it checks if the element # agree (which is the checkbox) is checked by using the .attr('checked') function. If it is then fadeIn the #saveForm element, and if not fadeOut the saveForm element.

提交回复
热议问题