How can I place a button inside a form which when clicked will not submit the form?
Demo HTML:
<form> <button>TEST</button> </form> <div></div> Demo JavaScript (jQuery):
$(document).ready(function() { $('form').submit(function() { $('div').append('SUBMITTED<br>'); return false; }); }); When the button is clicked the form gets submitted. Is there a way to disable this behavior (rendering this demo form unsubmittable)?
My actual use case for this is creating a bootstrap styled button to activate a file input.