Languages
[Edit]
EN

JavaScript - get input field value

4 points
Created by:
Majid-Hajibaba
972

In this short article, we would like to show how to get input value using JavaScript.

Quick solution:

// ONLINE-RUNNER:browser;

<input id="my-input" value="Some text here ..." />
<script>

    var element = document.querySelector('#my-input');

    console.log(element.value);  // Some text here ...

</script>

 

See also

  1. JavaScript - get textarea field value 
Donate to Dirask
Our content is created by volunteers - like Wikipedia. If you think, the things we do are good, donate us. Thanks!
Join to our subscribers to be up to date with content, news and offers.
Native Advertising
🚀
Get your tech brand or product in front of software developers.
For more information Contact us
Dirask - we help you to
solve coding problems.
Ask question.

❤️💻 🙂

Join