Button can show, but can't hide an element after showing. Could you tell me where i'm wrong?
document.querySelector('.btn1').onclick = function(e) {
let a = document.querySelector('.btn1content')
if (a.style.display = ('none')) {
a.style.display = ('block')
} else {
a.style.display = ('none')
}
}
.btn1content {
display: none;
}
<button class="btn1" BUTTON</button>
<p class="btn1content">Lorem ipsum</p>