0

I'm trying to get access to the user inputted data in an external javaScript so I can use it to run the main script. My form is

<form action="scripts/Main.js" method="post">
     <label>
          Enter Pin:
     </label>
     <input type="text" id="pin" name="pin" /> <br>
     <label>
          Enter Username: 
     </label>
     <input type="text" id="name" name="user_name" />
     <button type="submit">
          Submit Info
     </button>
</form>

I have no idea where to start in order to get and use the pin and name in the JavaScript.

Krunal Shah
  • 836
  • 8
  • 25
Matti_G
  • 1
  • 1
  • 2
    Possible duplicate of [JavaScript - Getting HTML form values](https://stackoverflow.com/questions/3547035/javascript-getting-html-form-values) – Jeremy Thille Apr 20 '18 at 13:29
  • you can find similar question here : https://stackoverflow.com/questions/1033345/getting-value-from-input-box-in-html-in-external-javascript – Chintan Apr 20 '18 at 13:30
  • 1
    What do you mean by "an external JavaScript"? What exactly is `action="scripts/Main.js"` attempting to do? It's not really clear to me what you're trying to do here. – David Apr 20 '18 at 13:32
  • Possible dublicate of [addEventListener on form submit](https://stackoverflow.com/questions/21338476/addeventlistener-on-form-submit) – Stanislav Machel Apr 20 '18 at 13:52

0 Answers0