I'm using Parsley to validate forms. I'm using 2.8 wbich is a more current version. When any button on my form is clicked (even it's not submit), Parsley will trigger a submit. For example I have this button which clears an uploaded photo.
<button id='attached-clear' onclick="App.clearPhoto('#attached')")
Clear
</button>
This will trigger a "submit" when Parsley is enabled. So when the user tries to clear the form it is submitted instead. I tried various options on the form of:
<form ... data-parsley-excluded='input[type=button]' ..>
And:
<button data-parsley-excluded="" ...>
But it always submits. If I disable parsley then I don't have a problem.
You need to add button type= 'button'
, submit is default value for type MDN ref
<form>
<button type='button' onclick="console.log('hello')">Clear</button>
</form>