I want to implement a box into my page, which is displayed on demand: a user presses a button, the div is shown.
As a visual example what i want to achieve, look at the keyboard-shortcuts box on jsfiddle (down left corner): http://jsfiddle.net/
Now i am not sure in which way i should do this:
- Create the div right away and set it to display: none while not needed
- Write a script which add's the div via JS
- Write a script which loads it from an external .html file
What way would you recommend?
Update
What if i got 15 different boxes which are not shown when the page loads, but should be added on demand? Sure, it would work, but can we call it "good practice" to simply hide every element we do not want to see?