<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>
<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>