Difference between type submit and button of <button> tag in HTML?

Dung Do Tien May 29 2020 538

I have a login form with two text boxes and a button. I see the type of <button> tag has two options is submit and button.  What is the difference between them?

<button type="submit" id="submitForm" >Login</button>

And

<button type="button" id="submitForm" >Login</button>

Thank many!!

Have 1 answer(s) found.
  • S

    Sandeep Kumar Jul 24 2020

    type="submit" : Help submit a form, it use to working with a <form> tag. This is the default feature.

    type="button" : You can not submit a form, it's helpful in some case manipulation with <input> tags but doesn't want to submit or reload the page.

    * Note: you also can submit a form with type="button" but you need to use javascript to submit the form and opposite.

Leave An Answer
* NOTE: You need Login before leave an answer

* Type maximum 2000 characters.

* All comments have to wait approved before display.

* Please polite comment and respect questions and answers of others.

Popular Tips

X Close