I am having a problem with IE. In my app, I have a dialog that the user can display. The dialog is built with data from an AJAX call. I then register a one time event handler for the button. In FF, Chrome, and Safari, I have no problems. The dialog displays and the button works. This has worked for a long time.
In IE, the dialog display, but sometimes the event handler does not fire. Clicking the button has no effect. This doesn't always happen. So far, it seems happen the first time you view the page after opening IE. Closing the dialog and reopening sometimes fixes it. Reloading the page sometimes fixes it. Once it is fixed, it doesn't seem to fail again regardless of page reload. Quitting IE is required to get the problem to re-occur. I haven't been able to use the developer tools because the problem disappears when the developer tools are open.
$('#btn_school_choices').button('loading');
$.ajax({
type: 'GET',
url: 'ajax/optimized_colleges.php',
dataType: 'json',
success: function(data, status, xhr) {
// Some code to prepare the data returned
// Build the dialog using the data and add to DOM
$('#modal_opt_in').html(ich.dialog_optimize_college_selection(optinData));
$('#btn_school_choices').button('reset');
// Add Event Handler to Button in Dialog
$('#btn_add_colleges').one('click', function() { ... }
// Show the Dialog
$('#modal_opt_in').modal({backdrop: 'static', show: true});
error: function(xhr) { ... }
});
I have tried using on() and off() and the same issue occurs. At this point, I have been trying to fix this for about two weeks. Any help would be appreciated.
The button should exist at the time of registering the event handler as it is added to the DOM two lines prior. (Even when the event handler fails, the dialog displays with the button, So the two lines prior to registering the event handler and the line after the event handler work.