Answer: function ShowHide(id)
{
document.getElementById(id).style.display == '' ? document.getElementById(id).style.display = 'none' : document.getElementById(id).style.display = '';
}
We can call this function like
<a href="#" onclick="ShowHide('divid')">Show/Hide</a>
If the "divid" is already displaying on the page it will hide if not it will show on the page and so on.
Asked In: Many interviews |
Alert Moderator