About forms

I was just wondering:

I know that IE handles “buttons” differently ( which essentially forces one to code the same text as value if one is to insure cross browser compatibility) But that aside, what is the best tag to use for a from button <input> or <button>?

If it’s <input> WHAT PURPOSE does the <button> tag ever serve?

Also, what is the better coding practice with regards to <label> ; do you wrap the label around the input tag ( <label for=“address”>Address:<input name='address"></label>) or code them side by side (<label for=“address”>Address:</label><input name='address">)

here’s a good article.

I remember reading about IE having issues with the button tag

they both can do the same thing, but can look, feel and be completely different.

<input> is an empty element. it’s also less css customizable.

<button> can have content, except for a few elements. it’s also more css versatile.

using one over the other means:

[]choosing if the richness in presentation is required
]choosing a complex over a more simpler solution
depending on requirements.

if you wrap a label around an element, you don’t need to specify for which element it is.

<label>Address: <input name="address"></label>

The are both <input> One is input <submit> and the other input <button>. The first one submits a form the second one is for more general often used with JavaScript

In addition the BUTTON element, e.g. submit button, reset button, or push button may have content such as an image or emphasis as was previously mentioned it’s basically richer.

With LABEL one power of the FOR attribute is basically regarding distance from the actual input, for example additional tags may occur that separate it somewhere else on the page but it gets linked via an ID.


but there is actually a BUTTON tag.

<input type=“button” name=“myButton” value=“my button”>
<button name=“myButton” value=“my button”>my button</button>

appear to output EXACTLY the same thing…