문제

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!

도움이 되었습니까?

해결책 2

You need to access its value property:

 document.getElementById("TextBox1").value

다른 팁

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

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top