spee.ch/public/assets/js/generalFunctions.js
2017-06-27 21:39:33 -07:00

18 lines
No EOL
518 B
JavaScript

function toggleSection(event){
event.preventDefault();
var dataSet = event.target.dataset;
var status = dataSet.open;
var masterElement = document.getElementById(event.srcElement.id);
var slaveElement = document.getElementById(dataSet.slaveelementid);
if (status === "false") {
slaveElement.hidden = false;
masterElement.innerText = "[close]";
masterElement.dataset.open = "true";
} else {
slaveElement.hidden = true;
masterElement.innerText = "[open]";
masterElement.dataset.open = "false";
}
}