Common.js: Difference between revisions
From Redrock Wiki
No edit summary Tag: Reverted |
No edit summary Tag: Reverted |
||
| Line 10: | Line 10: | ||
if (content.style.display === "block") { | if (content.style.display === "block") { | ||
content.style.display = "none"; | content.style.display = "none"; | ||
this.innerHTML = this.innerHTML.replace('-', '+'); | |||
} else { | } else { | ||
content.style.display = "block"; | content.style.display = "block"; | ||
this.innerHTML = this.innerHTML.replace('+', '-'); | |||
} | } | ||
console.log(this.innerHTML); | |||
}); | }); | ||
} | } | ||
}); | }); | ||
Revision as of 22:56, 31 March 2026
/* Any JavaScript here will be loaded for all users on every page load. */
$(function () {
var coll = document.getElementsByClassName("collapsibleList");
for (var i = 0; i < coll.length; i++) {
coll[i].addEventListener("click", function () {
var content = document.getElementById('list');
if (content.style.display === "block") {
content.style.display = "none";
this.innerHTML = this.innerHTML.replace('-', '+');
} else {
content.style.display = "block";
this.innerHTML = this.innerHTML.replace('+', '-');
}
console.log(this.innerHTML);
});
}
});