Jump to content

Difference between button and input type


sinalot
 Share

Recommended Posts

Hi guys,

I am a newbie with HTML5 and i have some questions: which is the difference between these tags?

 

1) <button type="button" onclick="function()>CIAO</button>
2) <input type="button" onclick="function()" value="CIAO">
3) <button type=submit>INVIA</button>
4) <input type="submit" value="INVIA">
According to me, 1) and 2) are the same thing (simple button).
Also 3) and 4) (a way to submit form).
Which form is used normally? Thanks
Link to comment
Share on other sites

That's been around since long before HTML 5.

 

The difference between <button> and <input type="button"> is that you're allowed to put elements inside the <button> tag. For example:

<button type="button">Click <strong>here</strong></button>

The same with <input type="submit"> and <button type="submit">.

  • Like 1
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...