Hi,
I have one global JS file that bind to the submit event of every form a function disabling each submit button.
Sometimes, i don't want the submit button to be disabled because a click from the user results in the download of a dynamically generated file, which means that the page doesn't change at all and the user just needs to be able to submit the form one more time.
That's why i added in a other JS file loaded after the first one, a piece of code to unbind the event. It goes like this :
- /* Global JS File */
- $(document).ready(function(){
- $('form').bind('submit.disable', function() {...});
- });
- /* Second JS File */
- $(document).ready(function(){
- $('form').unbind('submit.disable');
- });
It's working fine, the only things is that when i click the submit button, i got a Jquery error on line 1919. The job's is done but i get the error.
I fixed it that way :
- - var events = jQuery.data(this, "events"), handlers = events[ event.type ];
- + var events = jQuery.data(this, "events") || {}, handlers = events[ event.type ];
I don't know if it's the best way to fix it, maybe it's hidding a much bigger problem, but it's working, i just let you guys do whatever you want with it.
Best regards.