shradha-khapra/JavaScriptSeries

Issue related to .value

Opened this issue · 0 comments

Can somebody please help me in explaining why these lines of code not working

btn.addEventListener("click", (evt) => {
evt.preventDefault();
let amt = document.getElementById("amount");
let amtVal = amt.value;

if(amtVal < 0 || isNaN(amtVal) || amtVal == "") {
    amtVal = "1";
 
}

});