A
A
Andrey Ivanov2018-06-20 08:13:16
css
Andrey Ivanov, 2018-06-20 08:13:16

How to do: when you click on the button, show the block, when you click again, hide (on pure js)?

How to do: when you click on the button, show the block, when you click again, hide (on pure js)?
https://codepen.io/anon/pen/vrddEK

Answer the question

In order to leave comments, you need to log in

1 answer(s)
E
Evgeny Kornachev, 2018-06-20
@newdecline

var popup = document.querySelector('.popup');
var open = document.querySelector('.open');
popup.style.display = 'none'


open.addEventListener("click",      function() {

    if(popup.style.display == 'none')  popup.style.display = 'block';
    else popup.style.display = 'none'
    
  });

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question