Jquery AND statements

This is the jquery that I am running - the first part works just fine but the 2nd part doesn't.     No matter what it is showing the noregister div.   I looked at all the obvious suspects like capitalization issues.   Ideas?

<script type='text/javascript'>
  $(document).ready(function(){
	  	$("input[name$='prioraward']").click(function() {
        if ($(this).val()==1)  {
			 $("#wrongapp").show();
		}
		else {
			$("#wrongapp").hide();
		}
    });
	
	$('.research').change(function () {
            if ($("#priorawardno").is(":checked") && $("#childstatusyes").is(":checked") && $("#gpayes").is(":checked") && $("#programyes").is(":checked")) {
                $("#register").show();
            } else {
				$("#noregister").show();
            }
			
			   
			
        });
	  

    });
</script>

Open in new window


This is the HTML

<label for="prioraward">Question Text</label> <input type="radio" name="prioraward" id=priorawardyes" value="1" required data-response="Yes" class="research"> Yes <input type="radio" name="prioraward" id=priorawardno" value="0" required data-response="No" class="research"> No 

<div id="wrongapp" style="display:none; padding:15px;" class="warning">You are in the wrong application. </div>

</div>
</div>
    <div class="row">

<div class="col-md-12">


<label for="childstatus">Question Text</label> <input type="radio" name="childstatus" value="1" id="childstatusyes" class="research"> Yes <input type="radio" name="childstatus" value="0" class="research" id="childstatusno" > No 
</div>
</div>

    <div class="row">

<div class="col-md-12">
<label for="gpa">Questio Text</label> <input type="radio" name="gpa" value="1" class="research" id="gpayes"> Yes <input type="radio" name="gpa" value="0" class="research" id="gpano"> No 
</div>
</div>
<div class="row">
<div class="col-md-12">
<label for="">Question Text</label> <input type="radio" name="programtype" value="1" class="research" id="programyes"> Yes <input type="radio" name="programtype" value="0" class="research" id="programno"> No 
</div>
</div>

Open in new window

digitalwiseAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

ste5anSenior DeveloperCommented:
What "second part"?
digitalwiseAuthor Commented:
$('.research').change(function () {

is the part that doesn't work - it always shows the noregister div
Rainer JeschorCommented:
Hi,

first of all, you have some errors in your HTML DOM in the first two radiobuttons - the opening quotation marks for the id attribute are missing.

Second:
As you initially have none selected, it will always display the noregister div. You should add the following to the TRUE case:
$("#noregister").hide();

Open in new window

as well as this to the FALSE case

$("#register").hide();

Open in new window


Live sample:
http://jsfiddle.net/EE_RainerJ/98s2bu4L/

HTH
Rainer

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
digitalwiseAuthor Commented:
Ah for the want of a starting double quote!    I knew it was something stupid.   Blurry eyes!   Thanks you.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
jQuery

From novice to tech pro — start learning today.