Javascript show element on click
Solution 1:
document.getElementById('showDiv').onclick=function(){
// Remove any element-specific value, falling back to stylesheets
document.getElementById('element').style.display='';
};
Solution 2:
It's possible to attach event handlers completely within JavaScript. Example:
document.getElementById('showDiv').onclick = function() {
// Do whatever now that the user has clicked the link.
};
To reverse the effect of the first line of code you posted, you could use:
document.getElementById('element').style.display = 'block'; // or
document.getElementById('element').style.display = '';