I want to have a show/hide function for a <div>, using JavaScript/DOM properties.
Using JavaScript onclick() with two buttons, show and hide, each in their own <div>s, it would work something like this:
- By default, the
showbutton is hidden, the main<div>and hide button are displayed. Clicking thehidebutton hides the main<div>and ‘hide’ button itself, displays theshowbutton. - Clicking the
showbutton shows the main<div>and ‘show’ button displays thehidebutton I think this can be achieved using something likedocument.getElementById(DIVid).style.visibility="hidden".
But how do I do this?
Or if you want: