Im trying to write a function to be able to reproduce the action of hiding one element and make another appear. I know there is something in JQuery for thor that, but Im not there yet, so wanna solve it just with simple js.
const changeDisplay = (elm1, elm2) => {
let E1 = document.getElementById('elm1').style.display = 'none'
let E2 = document.getElementById('elm2').style.display = 'block'
return elm1.addEventListener('click', E1) &&
elm1.addEventListener('click', E2)
}
changeDisplay('not', 'ok')
TypeError: document.getElementById(...) is null script.js:6:21