Programming Tips - How can I avoid an html button from causing a submit of the form?

Date: 2015jan29 Language: html Q. How can I avoid an html <button> from causing a submit of the form? I have:
<button onClick="doSomething()">Do Something</button>
How can I avoid it submitting the form its in? A. You need to add type=button (yes, that seems redundant) like this:
<button type=button onClick="doSomething()">Do Something</button>