dns-daniel
9/19/2016 - 1:40 AM

Show and hide sections of a form

Show and hide sections of a form

function preparePage() {
	document.getElementById("brochures").onclick = function() {
		if (document.getElementById("brochures").checked) {
			// use CSS style to show it
			document.getElementById("tourSelection").style.display = "block";
		} else {
			// hide the div
			document.getElementById("tourSelection").style.display = "none";
		}
	};
	//progressive enhancement > enable first, in case user does not have javascript enabled, then disable if they do, until clicked
	// (hide it on the initial page load)
	document.getElementById("tourSelection").style.display = "none";
}

window.onload =  function() {
	preparePage();
};