Difference between input type and buttons

What is the difference between writing:

<input type="submit" value="submit"> and
<button>Submit</button>

I have also seen somewhere that it should be…


<input type='submit' value='text' />

<button type='submit'>text</button>

Which way is correct and must you always close the with />? because in the mmtuts tutorial on youtube, he just wrote

<input type="text" name="name">

without closing it…

Mozilla has a great reference for HTML. (You can even add it to the search engines in your browser.)

https://developer.mozilla.org/en-US/docs/Web/HTML/Element/button [quote=“piano0011, post:1, topic:295729”]
I have also seen somewhere that it should be…

<input type='submit' value='text' />
[/quote]

The trailing slash is only used if you have an xhtml doctype. If you’re using HTML it should be omitted.

1 Like

Note: no-one uses XHTML today, since it would bail out on even the smallest error.

Note: an XHTML doctype alone doesn’t make it an XHTML document (e.g. XHTML5 must be served without doctype). For that the XHTML MIME-Header is needed. So most XHTML you see out there is parsed as HTML.

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.