What is the efficient way to check the checkbox checked property using jQuery

I need to display a sub form in a form when a check box is checked in the main form. I tried using .attr('checked') code but it was not successful. Is there another method which is more efficient to do this? Please help.

Comments

  • You can use .toggle() in a better way.

    $('#yourSelectBox').click(function () {
        $("#yourSubForm").toggle(this.checked);
    });
    
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

In this Discussion