Quantcast
Channel: Making an element visible and hide upon click - Stack Overflow
Browsing all 6 articles
Browse latest View live

Answer by Gildas.Tambo for Making an element visible and hide upon click

Use ClassList.toggle and since you are using inline code you will need importantvar btn = document.querySelector("#menu-btn-toggle"), mask123 = document.querySelector("#mask123");function classToggle()...

View Article



Answer by misss-popcorn for Making an element visible and hide upon click

function showMask() { var node = document.getElementById('mask123'); if (node.style.visibility=='visible') { node.style.visibility = 'hidden'; } else node.style.visibility = 'visible'}This is how you...

View Article

Answer by fbid for Making an element visible and hide upon click

If you don't mind using jQuery you can use a simple function and a CSS class:// after removing onclick="" attribute from html $('#menu-btn-toggle').click(function(){...

View Article

Answer by bcherny for Making an element visible and hide upon click

.is is a jquery method. To use it, you first need to wrap your element/selector with jquery - $('#mask123').is(':visible').But you don't actually need jquery for this, you can do it in basic...

View Article

Answer by Rajaprabhu Aravindasamy for Making an element visible and hide upon...

Try to toggle the visibility property based on current value of it,function showMask() { var node = document.getElementById('mask123') var visibility = node.style.visibility; node.style.visibility =...

View Article


Making an element visible and hide upon click

I am trying to make an element #mask123 visible or hidden upon click. By default, the element is hidden, but as I click it becomes visible. The js below works on first click, and the element turns...

View Article
Browsing all 6 articles
Browse latest View live




Latest Images