What is the difference between <input type=button/> and <button> </button>? | Sololearn: Learn to code for FREE!
Novo curso! Todo programador deveria aprender IA generativa!
Experimente uma aula gr√°tis
+ 19

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

23rd Dec 2018, 11:22 AM
ūüćá Alex Tu»ôinean ūüíú
ūüćá Alex Tu»ôinean ūüíú - avatar
12 Respostas
+ 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>
24th Dec 2018, 3:59 PM
Gordon - avatar
+ 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
24th Dec 2018, 8:59 AM
Bipin Tatkare
Bipin Tatkare - avatar
+ 5
<button> tag is more beneficial as compared to input... u can put many bootstrap frameworks directly in button tag
23rd Dec 2018, 11:45 AM
Asad Memon
Asad Memon - avatar
+ 3
Same bootstraps classes could also be used in input tag too by defining class="btn btn-danger".
23rd Dec 2018, 6:06 PM
Sam diaz
Sam diaz - avatar
+ 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
24th Dec 2018, 10:18 AM
deepak sharma
deepak sharma - avatar
+ 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.
25th Dec 2018, 5:51 AM
Potato Hacker
Potato Hacker - avatar
+ 3
ai input type="button" used to form to send data to the server
26th Dec 2018, 5:01 AM
Mahmoud Sheshiny
Mahmoud Sheshiny - avatar
+ 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" />
25th Dec 2018, 4:09 AM
Sam diaz
Sam diaz - avatar
+ 2
25th Dec 2018, 8:35 PM
Jeannot Richecarde
Jeannot Richecarde - avatar
+ 1
25th Dec 2018, 8:35 PM
Jeannot Richecarde
Jeannot Richecarde - avatar
+ 1
You can make different styles. #<button> this type of code
28th Dec 2018, 7:38 AM
AJày - avatar
- 3
input haven‚Äôt ending tag e.g <input type=‚Äúsubmit‚ÄĚ value=‚ÄúSend‚ÄĚ>
24th Dec 2018, 8:47 AM
Kwee Shine
Kwee Shine - avatar