<button> Vs <input type="button"> ✌🌼💙 | SoloLearn: Learn to code for FREE!

+36

<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.. 💙

3/28/2018 5:06:35 PM

Baraa AB

32 Answers

New Answer

+29

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.

+14

Mohammad Ismail ok, thanks bro!!

+12

Jayden LeCorps thanks a lot my friend 💙

+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.

+10

https://stackoverflow.com/questions/469059/button-vs-input-type-button-which-to-use

+9

Raj Chhatrala i search in this website before asking, but i didn't understand well.. thanks for answer bro 👍

+9

Toni Isotalo can you explain more?!

+9

nic3..question but i think the answers were not precise......well we all know.......one is value and other is tag but......😕

+9

This ”mentioned” thingy is cool. You’re welcome

+8

Mohammad Ismail yeah i know that.. but when should i use button tag and when button value?!

+8

@striker @Jayden yeah for now no good answer!! wait someone to help me :D

+8

ah ok , i understand now!! thanks bro 💚😉 MD. Tanjed Hasan Riyad

+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.

+7

Baraa AB me tooo bro.....😊

+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.

+7

Robert Brown Farley (brofarops) thanks a lot!! Now i start understand a little!!💙

+7

Toni Isotalo Thanks a lot my friend 💙

+7

Toni Isotalo yeah hehe.. 😂💙

+7

no in input tag we can use text, password, number, button,etc..💚😉 MD. Tanjed Hasan Riyad

+6

yup you add additional attributes and elements for better rendering, thus "radio"