Help! toggle

Hi everyone,

Im trying to get this hide, show, gife image to work on multiple pages but it seems to be working only on the first page not on the other pages?

here is my code:

echo “<div id=\“headerDivImg\” class=\“displayTitle\”>$title_txt<a id=\“imageDivLink\” href=\“javascript:toggleDiv(‘contentDivImg’, ‘imageDivLink’);\”><img src=\”…/img/minus-2.png\"></a> </div> ";
echo “<div class=‘maintitles_jd’ id=‘contentDivImg’ style=‘display:block;’ >”; //job description content

<script type=“text/javascript”>
function toggleDiv(showHideDiv, switchImgTag) {
var ele = document.getElementById(showHideDiv);
var imageEle = document.getElementById(switchImgTag);

        if(ele.style.display == "block") {
        	ele.style.display = "none";
			imageEle.innerHTML = '&lt;img src="../img/plus-2.png"&gt;';
        }
        else {
        	ele.style.display = "block";
            imageEle.innerHTML = '&lt;img src="../img/minus-2.png"&gt;';
        }
	
}

</script>

Hi,

Could you post a link to a page where the code works and a second link to a page where it doesn’t.

What im trying to do is - is it possible to have multiple ID toggle?

Yes, that should be possible, but I still haven’t really grasped what you are trying to do.