Binding multiple times
by justinwyllie
HTML
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.2.4/jquery.min.js"></script>
<form id="testform" method="POST">
<input type="text">
<button>
Submit
</button>
</form>
<button id="mybutton1">
Press
</button>
JavaScript
$(function() {
/* just using one() may not fix this issue - may want to use off() as well
because even with one() it is still bound if not used
*/
$('#mybutton1').click(function() {
$('#testform').submit(function(e) {
console.log("submitted");
e.preventDefault();
});
});
});