interviews.dotnetthread.com

↑ Grab this Headline Animator

Monday, June 30, 2008

How to toggle display an HTML element in Javascript?

function ToggleFollowingText(id)
{
document.getElementById(id).style.display == '' ? document.getElementById(id).style.display = 'none' : document.getElementById(id).style.display = '';
}
In above function you need to pass id of the html element as the parameter.
If the control is already displaying then it will hide otherwise it will be shown.

Submit this story to DotNetKicks

No comments:

Post a Comment

Post your comments/questions/feedback for this Article.

 

Latest Articles