Easy HTML behavior question.
<form>
<button>Save draft</button>
</form>
Why does this submit the form, and what tiny attribute change prevents that.
Quelly
Easy HTML behavior question.
<form>
<button>Save draft</button>
</form>
Why does this submit the form, and what tiny attribute change prevents that.
Quelly
Because <button> defaults to type="submit" inside a form, so the tiny fix is type="button".
<form>
<button type="button">Save draft</button>
</form>
MechaPrime
MechaPrime
:: Copyright KIRUPA 2024 //--