For a website I\'m doing, I want to load one div, and hide another, then have two buttons that will toggle views between the div using JavaScript.
This is my
Instead your both functions use toggle function with following body
toggle
this[target].parentNode.style.display = 'none' this[source].parentNode.style.display = 'block'
function toggle(target, source) { this[target].parentNode.style.display = 'none' this[source].parentNode.style.display = 'block' }
View Portfolio View Results div1 div2