Strange facts about HTML

(written by lawrence krubner, however indented passages are often quotes). You can contact lawrence at: lawrence@krubner.com

I feel like I’ve been away from HTML for awhile. 10 years ago I thought of myself as having some design skill, and I did a lot of front-end work, but in 2009, I moved to New York City and worked in some big companies with strict divisions of labor. I was a backender, and backenders are never frontenders. So I’ve been away from the frontend for awhile. It is slowly becoming foreign territory to me. I was surprised to learn that button defaults to being a submit button:

Always set a type on $lt;button>s
The default value is submit, meaning any button in a form can submit the form. Use type=”button” for anything that doesn’t submit the form and type=”submit” for those that do.

$lt;button type=”submit”>Save changes$lt;/button>
$lt;button type=”button”>Cancel$lt;/button>
For actions that require a $lt;button> and are not in a form, use the type=”button”.

$lt;button class=”dismiss” type=”button”>x$lt;/button>

Source