What is the difference between <input type=button/> and <button> </button>? | SoloLearn: Learn to code for FREE!

+19

What is the difference between <input type=button/> and <button> </button>?

12/23/2018 11:22:41 AM

💜 Alex Tușinean 🍇

13 Answers

New Answer

+16

1. Lol. The difference is NOT about (i) having ending tag or not or (ii) can be styled with CSS or not or (iii) can use bootstrap or not. Demo: https://code.sololearn.com/Wzj2zu5sI6Zz/?ref=app 2. <input type="button" > - is the old way of HTML button, it has full compatibility with even the earliest version of browsers. Source: MDN https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/button - if you want to edit the content inside the button, you have to use an attribute value, which is very inconvenient. 3. <button> - is new way than <input type="button" >, But still earlier enough to be safe for us to claim it as being fully compatible with browsers. - the development of button is with <button> It has attributes such as autofocus, disabled, just to name a few. Source: MDN https://developer.mozilla.org/en-US/docs/Web/HTML/Element/button 4. Also, if you are taking onclick activity, it doesn't have to be a button, you can use image, div or any other element. Button is more about <form>

+7

<input type = button /> makes you be able to access the features of buttons..... For eg. After clicking some procedure will happened in program , and so on you derived in the input. Now. ... <button></button> helps you to create a button with some specifications and some graphical content you will make in this tag. You will be able to modify , and give features for these derived button . If above explanation won't get it , check it out here , https://www.google.com/url?sa=t&source=web&rct=j&url=https://www.tutorialspoint.com/What-is-difference-between-button-vs-input-type-button&ved=2ahUKEwj4moLrjLjfAhXNXn0KHVcjD4EQFjABegQIDhAF&usg=AOvVaw32lXOGPFp3xE9hyhzB-x-I https://www.google.com/url?sa=t&source=web&rct=j&url=https://www.codecademy.com/en/forum_questions/4fb1e86d44ebdc000301f96e&ved=2ahUKEwj4moLrjLjfAhXNXn0KHVcjD4EQFjANegQICRAB&usg=AOvVaw0GUW5sAf-N1zCq_vgoSsSp&cshid=1545641976205

+5

<button> tag is more beneficial as compared to input... u can put many bootstrap frameworks directly in button tag

+3

Same bootstraps classes could also be used in input tag too by defining class="btn btn-danger".

+3

sing HTML forms, you can easily take user input. The tag is used to get user input, by adding the form elements. The type attribute is used to add a button inside the tag. The short answer is that button behaves differently in IE6/7 versus other browsers, whereas input button behaves the same in all browsers. https://www.tutorialspoint.com/What-is-difference-between-button-vs-input-type-button

+3

Short answer: Nothing, the same long Answer: Nothing, you may need to use <button> and <input type=“button”> at different times, input should be the alternative for the button. and button tag when outside of a form.

+3

ai input type="button" used to form to send data to the server

+2

Kwee Shine u are right but that is not compulsory u can put an / in the tag that would not break your html nor your css. <input type="button" class="btn btn-danger" name="submit" value="submit" />

+2

+2

+1

You can make different styles. #<button> this type of code

-3

input haven’t ending tag e.g <input type=“submit” value=“Send”>