Show/Hide Elements

Automatically update your pages

There are certain times that you want to dynamically show or hide elements based on a user's selection. Luckily, this is quite easy with javascript.

NOTE: These functions use the getObject() function that I have described on the previous page. If you do not include this function in your script, the code will not work at all and will return an error.

function showElement(el) {
     getObject(el).style.display = '';
}

function hideElement(el) {
     getObject(el).style.display = 'none';
}

Thats it! Whenever you want to show your element, just call the showElement() function and pass it the id of the element. To hide the element, call the hideElement() function.

Javascript

Ads