JQuery click event re-firing is not working in IE
Running IE 11.0.9600.18524.
I have a function which stops the default click event, performs some actions, and then after those actions are finished, triggers the event again to proceed with the form submission:
- $('#submit').on('click', function(event){
- if (valid === true) {
- valid = false;
- return;
- }
- event.preventDefault();
- valid = true;
- //do some stuff
- $(this).trigger('click');
- });
This works nicely in Chrome, all of the form actions complete and then the button triggers itself to submit the form.
It is not working in IE 11. Through outputting
valid at various points to the console, the function seems to be working correctly and re-triggering itself, and
valid is set properly where it should be, however nothing happens at the
return line. The function ends but the form does not submit.
I have tried replacing
$(this).trigger('click'); with the following:
- $(this).click(); -- this behaves the same as current.
- $('#submit')[0].click(); -- this does not fire at all.
- $(this).unbind('click').click(); -- also does not fire.
The form submits if I double click quickly enough that my second click goes through after
valid has been set to true by the first click but has not been returned to false yet, meaning I'm suspecting the browser is having issues simulating clicks.
Is this issue solvable?