This happens because the script merely captures the HTML for the default contents once when the page loads, then uses that whenever the default tab is selected. It does this because the entire content container is overwritten each time a tab is selected, so capturing is required.
A workaround is to tell the script to look for the default content within a container defined outside the content container on your page. That way that content is never overwritten. To do this, first, use the below modified version of the .js file. Then in your HTML, instead of the usual:
Code:
<div id="countrydivcontainer" style="border:1px solid gray; width:450px; margin-bottom: 1em; padding: 10px">
Your default contents used to go here
</div>
Do the following instead:
Code:
<div id="countrydivcontainer" style="border:1px solid gray; width:450px; margin-bottom: 1em; padding: 10px">
</div>
<p id="defaultcontentcontainer" style="display:none">This is some default tab content, embedded directly inside this space and not via Ajax. It can be shown when no tabs are automatically selected, or associated with a certain tab, in this case, the first tab.</p>
<script type="text/javascript">
var countries=new ddajaxtabs("countrytabs", "countrydivcontainer", "defaultcontentcontainer")
countries.setpersist(true)
countries.setselectedClassTarget("link") //"link" or "linkparent"
countries.init()
</script>
Bookmarks