On one of my pages (let's call it "page1"), I have multiple divs, some nested within others. These divs are initially hidden and toggle on when a specific link is clicked (and off when clicked again). To view a nested div, the outer div must be opened first.
An example can be found here
Now, my client wants a link on another page ("page2") to directly open a specific nested div on page1 along with its outer div. How can this be achieved?
By using:
<a href="page1.html#divid5">clickfordivid5</a>
The nested div opens but remains hidden because the outer div is still hidden. Is there a way to toggle both divs with just one link?
Thank you for any help!
Additional information:
This script is being utilized:
<script type="text/javascript">
function toggle(id) {
var el = document.getElementById(id);
if (el.style.display == "block") {
el.style.display = "none";
} else {
el.style.display = "block";
}
}
</script>
Used with:
<a href="javascript:toggle('divid5');">
alongside
<div class="ToggleTarget" id="divid5">