Quantcast
Viewing latest article 2
Browse Latest Browse All 4

Answer by Sumurai8 for How to get text from a textbox using javascript

In an input element, the value of can be found in a value property of that element. It can therefore be retrieved via document.getElementById('idOfElement').value.

In an textarea element has it's value between the starting and the closing tag. Therefore, the value property is empty. In raw javascript, you would be able to retrieve the contents with document.getElementById('idOfElement').innerText.

If you are however using jQuery, Ufuk's solution with .val() is much easier to use.


Viewing latest article 2
Browse Latest Browse All 4

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>