const checkButton = document.getElementById("check-btn");
const input = document.getElementById("text-input");
const result = document.getElementById("result")
checkButton.addEventListener("click", ()=> {
if(input.value == ''){
alert ("Please input a value");
} //it works like this
})
//but once i put like this, i just can't make it work
const checkIsEmpty = () => {
if(input.value == ''){
alert ("Please input a value");
}
}
checkButton.addEventListener("click", checkIsEmpty())
const checkButton = document.getElementById("check-btn");
const input = document.getElementById("text-input");
const result = document.getElementById("result")
checkButton.addEventListener("click", ()=> {
if(input.value == ''){
alert ("Please input a value");
} //it works like this
})
//but once i put like this, i just can't make it work
const checkIsEmpty = () => {
if(input.value == ''){
alert ("Please input a value");
}
}
checkButton.addEventListener("click", checkIsEmpty())