I have 2 div’s that I need consecutively toggled back and forth showing and not showing. Here is my current jQuery code
$(document).ready(function(){
$('a:link').click(function(){
$(".surveycontainer").toggle();
$("#check").toggle();
});
});
Note #check is hidden on page load via CSS so this script says when a link is clicked each will be toggled, making the “surveycontainer” div disappear and the “check” div appear and vice versa.
The script works fine when calling a RSS feed within the surveycontainer (containing a link) and when clicked each div’s are toggled. The problem occurs when a plain link is placed in the div, when clicked the “surveycontainer” is hidden however “check” is not shown!
Surveycontainer code
<div class="surveycontainer" align="left">
<?php
// OFFERS
//Right here is a script that defines $country_code ("US" is what is called when the problem occurs)
<?php if($country_code=="US"): ?>
<a href="http://www.google.com" target="_blank">Yahoo</a>
<?php else: ?>
//Calls a RSS feed containing links here
</div>
<?php endif; ?>
As you can see if the $country_code equals “US” the Google link is called in a new window.
For some reason when the country code does not equal US and the data is pulled from the RSS feed the jQuery script above stands and each div is toggled when a link is clicked. However, when the Google link is used and clicked only the “surveycontainer” div is hidden and “check” is not shown.
I am in desperate need for a solution to this problem! Any help is greatly appreciated, thank you!!
place
<?php endif; ?>before</div>it is not giving to end yoursurveycontainerdivwhen condition for google link is satisfied. so re-writing your code will look like: