I’ve dealt with WP js conflicts before, but this one has me stumped. I have a simple form with four questions. The user must click yes on all for the link to show up. I’ve been able to recreate this with only jquery 1.6.2 on a single pg on a test server, so I know the js and the form work.
<script type="text/javascript">
$(document).ready(function() {
$('input:radio').change(function(){
if(
($('input:radio[name=group1]:checked').val() == 'Yes') &&
($('input:radio[name=group2]:checked').val() == 'Yes') &&
($('input:radio[name=group3]:checked').val() == 'Yes') &&
($('input:radio[name=group4]:checked').val() == 'Yes')
){
document.getElementById('pdflink').innerHTML = '<div><a href="http://www.mydomain.com/somefile.pdf">grab the file here</a></div>';
}
else {
document.getElementById('pdflink').innerHTML = '';
}
});
});
</script>
<form name="myform" action="" method="POST">
<div><br>
<p>Question 1?</p>
<input type="radio" name="group1" value="Yes"> Yes<br>
<input type="radio" name="group1" value="No"> No<br>
<hr>
<p>Question 2?</p>
<input type="radio" name="group2" value="Yes"> Yes<br>
<input type="radio" name="group2" value="No"> No<br>
<hr>
<p>Question 3?</p>
<input type="radio" name="group3" value="Yes"> Yes<br>
<input type="radio" name="group3" value="No"> No<br>
<hr>
<p>Question 4?</p>
<input type="radio" name="group4" value="Yes"> Yes<br>
<input type="radio" name="group4" value="No"> No<br>
</div>
</form>
<div id="pdflink">
</div>
Here’s the link: http://www.hcfmissoula.com/grants/compassionate-care-grant
I’ve tried using the jQuery.noConflict approach with no luck. Please help if you can…
@blackessej, your code is not making it to the client side. This is what I see in my browser:
The && operators are getting escaped and there are random <p> tags in your script.