I have a little problem. I have already looked at many threads like:
- jquery submit function not working
- jQuery submit function not working properly
- JQuery Submit Form From Inside Submit Function
But I have the problem that my submit doesn't work. I don't see why.
I would be happy if someone could explain to me why the submit button doesn't work.
I don't see a log in the console submit.
My goal is:
1. click on a button which is not a submit button
2. do some stuff then
3. then start submit & do something there
<!DOCTYPE html>
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.0.0/jquery.min.js"></script>
</script>
</head>
<body>
<form method="post" action="submit.html" id="test">
<input type="button" id="bttn" value="Submit"></input>
</form>
</body>
</html>
<script language="javascript" type="text/javascript">
$(function() {
$( 'input#bttn' ).on( 'click', function() {
// do something
console.log('click');
// start submit
$( 'form#test' ).submit( function() {
console.log('submit');
return true;
});
});
});
</script>