Javascript

Topic: JS Window

How to toggle display an HTML element?

Call following functionfunction 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.

Browse random answers: