I'm new at ES6 and I'm trying to display to none a div when an inner button is clicked.
I tried this but it's not working:
const hide = () => {
const z = document.getElementById('button')
const y = document.getElementById('block')
z.onclick = () => {
y.style.display='none'
}
}
<div id="block">
<button id="button" onClick="hide()">my button</button>
</div>
Any help please?