I've got this javascript toggle array script. It was working and I don't know what point it broke, but I am having trouble getting it working again. The code below is linked in an external .js file:
function toggle(showHideDiv, switchTextDiv) {
var ele = document.getElementById("showHideDiv");
var text = document.getElementById("switchTextDiv");
if(ele.style.display == "none") {
ele.style.display = "block";
text.innerHTML = "-";
}
else {
ele.style.display = "none";
text.innerHTML = "+";
}
}
function toggle2(contentDiv, controlDiv) {
if (contentDiv.constructor == Array) {
for(i=0; i < contentDiv.length; i++) {
toggle(contentDiv[i], controlDiv);
}
}
else {
toggle(contentDiv, controlDiv);
}
}
Here is my href, as you can see the script toggles multiple div's.
<a id="Collapse" href="#" onclick="javascript:toggle2(,'Collapse');" onmouseover="hide()">
Can someone please tell me the problem?