how to get input from input tag in javascript code example

Example 1: value from getelementbyid

document.getElementById('numbers').value

Example 2: Javascript get text input value

var inputValue = document.getElementById("myTextInputID").value;

Example 3: how to get an input in html

<!DOCTYPE html>
<html>
   <body>
      <head>
         <title>HTML Forms</title>
      </head>
      <p>Add your details:</p>
      <form>
         Student Name:<br> <input type="text" name="name">
         <br>
         Student Subject:<br> <input type="text" name="subject">
         <br>
         Rank:<br> <input type="text" name="rank">
      </form>
   </body>
</html>

Tags:

Java Example