
September 23rd, 2012, 09:49 PM
|
 |
Contributing User
|
|
|
|
Change the style for all of the elements, that you want to hide; to display "none" and then set the element, you want to display, to a block level element.
Something like...
Code:
function showStuff(id) {
// you could do this with a for or while loop, as well... that would be less repetition and reduce memory usage
new hideStuff('question1');
new hideStuff('question2');
new hideStuff('question3');
document.getElementById(id).style.display = 'block';
}
function hideStuff(id) {
// or... use document.getElementById(id).className; that's what your really asking in your question, but you will need to add your css classes for this to work
document.getElementById(id).style.display = 'none';
}
}
Last edited by web_loone08 : September 23rd, 2012 at 09:54 PM.
|