Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR HTML

how to get value of textbox in javascript from html

<!--
This is example is with a number...
But you can do it with whatever input type you want
-->
<input type="number" name="numberInput" id="numberInput" max="20" min="1" step="1">
<button type="button" onclick="myFunction()">sumbit</button>

<script>
  function myFunction() {
    let tokenAmount = document.getElementById("numberInput").value;
    return // whatever you want to do with it
  }
</script>
 
PREVIOUS NEXT
Tagged: #textbox #javascript #html
ADD COMMENT
Topic
Name
9+7 =