Pergunta

I'm trying to get value of TextBox1 the following way:

  document.getElementById("TextBox1").innerText

but for some reason it doesn't work, I tried it in Chrome and IE. when I do:

  document.getElementById("TextBox1").style.backgroundColor

I get the values, so for some reason it doesn't work only with innerText. is there an alternative way to get value of a textbox? thanks!

Foi útil?

Solução 2

You need to access its value property:

 document.getElementById("TextBox1").value

Outras dicas

I don't see the tag name but if it is input[type=text] so use .value property

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top