Swap HTML Elements Using Javascript


It is quite easy to use javascript to swap between divs or any other html dom elements.
Using the function below you can pass the id of the element to show and to hide.

function swapDivs(show, hide){
    document.getElementById(show).style.display = "block";
    document.getElementById(hide).style.display = "none";
}