Why doesn't it display text?

const textInput = document.getElementById("text-input")
const btn = document.getElementById("check-btn")
const result = document.getElementById("result")

btn.addEventListener("click",()=>{
  if(textInput.value === ""){
    result.textContent="Please input a value"
  }
 
})

why doesn’t it display text?

what doesn’t display text?

also, what is your html, that is needed for debugging

alert, but for some reason the click doesn’t work for me, or rather even the javascript itself doesn’t work in this program

Post your HTML. Your code works for me with the correct HTML and ids.

The first 3 tests should be passing. If they are not your HTML is not correct.

I understood what the problem is in html

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.