jquery check if radio button is checked and then check if tickbox is checked

0 votes

Hi, I have a two part form which I have developed. One is for existing members and one is not.

On one of the forms I have a checkbox which will need to be checked before they can proceed, to determine that they are on the correct form. I will use the radio button which hides and unhides forms.

However when I try to get a handle on if the radio button is checked and then checking to see if the checkbox is checked I get nothing returned.

Can someone help me implement this? My JS is below or view my JSFIDDLE:

$(document).ready(function(){

    var check;   

    if($("input:radio[name=existingpartner]").is(":checked")){

        // Example 3 - With jQuery prop  
    $("#test-with-prop").on("click", function(){
        check = $("#mycheckbox").prop("checked");
        if(check) {
             alert("Checkbox is checked.");
        } else {
            alert("Checkbox is unchecked.");
        }
    }); 
});

Aug 1 in Web Development by gaurav
• 17,580 points
13 views

1 answer to this question.

0 votes

This is the best and the most recommended way when using jQuery:

if( $('#radio').is(':checked') ){
    alert("Radio Button Is checked!");
}
else{
    alert("Radio Button Is not checked :( ");
}
answered Aug 1 by rajatha
• 7,040 points

Related Questions In Web Development

0 votes
0 answers

How to check radio button is checked using JQuery?

I have two radio buttons in one ...READ MORE

Jun 29 in Web Development by gaurav
• 17,580 points
12 views
0 votes
0 answers

jQuery: Test if checkbox is NOT checked

I'm having trouble figuring this out. I ...READ MORE

Jun 29 in Web Development by gaurav
• 17,580 points
22 views
0 votes
0 answers

jQuery if checkbox is checked

I have a function below that I ...READ MORE

Jun 29 in Web Development by gaurav
• 17,580 points
9 views
0 votes
1 answer

What is the difference between JavaScript and jQuery?

JavaScript is an independent language and can ...READ MORE

answered Jun 27 in Web Development by rajatha
• 7,040 points
28 views
0 votes
1 answer

How to automate radio button and checkbox on a webpage in Selenium Webdriver?

Hey Yashmita, following code snippet automates the ...READ MORE

answered Jul 23, 2019 in Selenium by Anvi
• 14,170 points
1,569 views
0 votes
1 answer

How to check a radio button with jQuery?

For versions of jQuery equal or above ...READ MORE

answered Feb 23 in Java by Aditya
• 7,300 points
76 views
0 votes
1 answer

jQuery checkbox change and click event

Have shared an approach which will add ...READ MORE

answered Feb 23 in Java-Script by Aditya
• 7,300 points
2,147 views
0 votes
1 answer

Check if checkbox is checked with jQuery

To check whether a Checkbox has been ...READ MORE

answered Jun 23 in Web Development by rajatha
• 7,040 points
34 views
0 votes
1 answer

jQuery get value of selected radio button

Input Radio value Property Get the value of ...READ MORE

answered Jun 23 in Web Development by rajatha
• 7,040 points
58 views
webinar REGISTER FOR FREE WEBINAR X
Send OTP
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP