<button> Vs <input type="button"> ✌🌼💙 | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 38

<button> Vs <input type="button"> ✌🌼💙

What is the difference between this two tag?! when and where can we use them?! when we can use one of them?! Thanks for your help in advance.. 💙

28th Mar 2018, 5:06 PM
Baraa AB
Baraa AB - avatar
32 Answers
+ 30
You can use html in <button></button> With <input type="button"> you can only use string as value value="string". You can use spans inside <button>. But according to W3C divs inside a button is incorrect in HTML5 <button> <span style="color: red">Hello</span> <span style="color: black">World</span> </button> Input tags are "meant" to be used inside a form and <button> outside on random click events. And of course <input type="button"> has all <input> tags attributes.
28th Mar 2018, 5:08 PM
Toni Isotalo
Toni Isotalo - avatar
+ 14
Mohammad Ismail ok, thanks bro!!
28th Mar 2018, 6:15 PM
Baraa AB
Baraa AB - avatar
+ 12
Jayden LeCorps thanks a lot my friend 💙
28th Mar 2018, 6:03 PM
Baraa AB
Baraa AB - avatar
+ 12
When you wanna make a button to within form then you have code <input type ="button"> (Here button is a value) as well as if you wanna just a make button you can use <button></button> Tag.
28th Mar 2018, 6:06 PM
Mohammad Ismail
Mohammad Ismail - avatar
+ 9
Raj Chhatrala i search in this website before asking, but i didn't understand well.. thanks for answer bro 👍
28th Mar 2018, 6:04 PM
Baraa AB
Baraa AB - avatar
+ 9
Toni Isotalo can you explain more?!
28th Mar 2018, 6:04 PM
Baraa AB
Baraa AB - avatar
+ 9
nic3..question but i think the answers were not precise......well we all know.......one is value and other is tag but......😕
28th Mar 2018, 6:29 PM
STRIKER
+ 9
This ”mentioned” thingy is cool. You’re welcome
28th Mar 2018, 8:20 PM
Toni Isotalo
Toni Isotalo - avatar
+ 8
Mohammad Ismail yeah i know that.. but when should i use button tag and when button value?!
28th Mar 2018, 6:08 PM
Baraa AB
Baraa AB - avatar
+ 8
@striker @Jayden yeah for now no good answer!! wait someone to help me :D
28th Mar 2018, 6:34 PM
Baraa AB
Baraa AB - avatar
+ 7
If you wants to makes a form use button value (submit button,send button) and when you wants make just button use Tag. Basically these two are same.
28th Mar 2018, 6:14 PM
Mohammad Ismail
Mohammad Ismail - avatar
+ 7
Baraa AB me tooo bro.....😊
28th Mar 2018, 6:36 PM
STRIKER
+ 7
for one the <button></button> is for basically jumping around in a website whereas <input type="button"> is a radio button better for forms and widgets.
28th Mar 2018, 8:09 PM
BroFar
BroFar - avatar
+ 7
Robert Brown Farley (brofarops) thanks a lot!! Now i start understand a little!!💙
28th Mar 2018, 8:10 PM
Baraa AB
Baraa AB - avatar
+ 7
Toni Isotalo Thanks a lot my friend 💙
28th Mar 2018, 8:19 PM
Baraa AB
Baraa AB - avatar
+ 7
Toni Isotalo yeah hehe.. 😂💙
28th Mar 2018, 8:25 PM
Baraa AB
Baraa AB - avatar
+ 7
no in input tag we can use text, password, number, button,etc..💚😉 MD. Tanjed Hasan Riyad
13th Apr 2018, 12:51 PM
Baraa AB
Baraa AB - avatar
+ 7
ah ok , i understand now!! thanks bro 💚😉 MD. Tanjed Hasan Riyad
13th Apr 2018, 1:56 PM
Baraa AB
Baraa AB - avatar
+ 6
yup you add additional attributes and elements for better rendering, thus "radio"
28th Mar 2018, 8:16 PM
BroFar
BroFar - avatar