I have a form that I load into a popover via ajax. The form is defined like:
<form id="generate_form" class="form" accept-charset="UTF-8" action="/tokens/create" method="POST">
I wanted to trap the form submit, and submit the data using AJAX instead. So I added the following script:
$(document).ready(function () {
$(this).on('submit','#generate-form', function (e) {
alert('trapped?');
return false;
});
});
However, when I try this, the form event is not trapped, i.e. I never see the alert dialogue. Am I doing something wrong?
You misspelled
"#generate-form"(underscore instead of dash) and forgot some parenthesis: