Hey everyone,

I am not sure how to ask this, but this is what I am wondering.

I am new to JS and am looking at a lot of webpages' sources. The thing that keeps coming up that I can't figure out is when you click a button (whatever it may be: next, submit, etc) how does it compare the input value to whatever it has. The button is given the input type = 'submit' but it doesn't explain where its destination is or what its comparing inputed data with.

Hope I explained well enough.

p.s. Thanks for any replies, and I have tried to look this question up; however, appears to be to vague.

5 Years
Discussion Span
Last Post by Airshow

Submit buttons are a feature of HTML, not javascript.

They work in association with the <form>...</form> in which they are embedded.

  • The form tag's action attribute determines the URL that is requested
  • The form tag's method attribute (GET or POST) determines how the form data (user inputs and selections) are packaged into the HTTP request.

Javascript can be used to intercept a form submission after a submit button is pressed in order to perform, for example, validation checks. Javascript can suppress form submission on failure to validate, or allow submission if everything appears to be OK.


Edited by Airshow: n/a

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.