EN
JavaScript - get input field value
4 points
In this short article, we would like to show how to get input value using JavaScript.
Quick solution:
xxxxxxxxxx
1
<input id="my-input" value="Some text here ..." />
2
<script>
3
4
var element = document.querySelector('#my-input');
5
6
console.log(element.value); // Some text here ...
7
8
</script>