I have a page which uses jQuery & parsley plugin for form validation and submission. Below is the event handler for the form,
$('#formid').parsley().on('form:submit', function(event) {
//handle form submit
});
I have another pure JavaScript listener function to be executed on submit of the form. Below is the code snippet,
document.getElementById("formid").addEventListener("submit",function(e){
//Some code to be executed after form submit
});
I have a requirement not to use jQuery for the above function.
Now the problem is, parsley is stopping flow of events down the line by using event.stopImmediatePropagation();
Because of this, the second event handler is not getting executed. Is there a way I could make my pure javascript handler to execute first? I came across this jQuery solution to bindUp an event handler. But I need pure javascript solution. Any help is greatly appreciated.
Update: Here is JSFiddle for my problem.