Link to home
Start Free TrialLog in
Avatar of chokka
chokkaFlag for United States of America

asked on

How to enable or disable radio button based on check box selection in Jquery ?

How to enable or disable radio button based on check box selection in Jquery ?

Check box click function is written inside the ready. function.

 $("#Other").on("click", function ()
    {
        if ($("#Other").is(":checked"))
        {   
            document.getElementById('Yes').disabled = false;
            document.getElementById('No').disabled = false;
        }
        else
        {
            document.getElementById('Yes').disabled = true;
            document.getElementById('No').disabled = true;
        }
    });
    $("#Other").trigger("click");

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of Julian Hansen
Julian Hansen
Flag of South Africa image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of chokka

ASKER

It doesn't have a trigger event. In my study from online, click function needs a trigger event to fire
Avatar of chokka

ASKER

Thank you Julian, I will accept as solution. However, the solution which I have has. Trigger event to fire the click function
I can add the trigger event - by why do you need it? Why not just set the state of the checkbox and radio's to what you want when the page loads?
Avatar of chokka

ASKER

Thanks