JSFiddle - React, Tailwind, and code Playground
by Montinyek
HTML
<div id='hello'>
hello
</div>
<div id='btn'>
button
</div>
JavaScript
let btn = document.getElementById('btn')
let hello = document.getElementById('hello')
function test() {
if (hello.style.display !== 'block') {
hello.style.display = 'block'
} else {
hello.style.display = 'none'
}
}
btn.addEventListener('click', test)