Button does not change to disabled if dialog reappears in IE11

I have a problem with a property of a disabled

button in an ASP page. This only happens in IE 11 and works well in other browsers.

These are my steps prior to the problem:

1: I click the download button and a dialog box appears. I am checking 2 checkboxes to enable button loading. Then I click the same download button and the file is saved.

2: I click the download button again and a dialog box appears. But now the button is still enabled and the checkboxes are unchecked. However, when I move my mouse over the download button, it immediately changes to disabled.

Expected Behavior: The button should be disabled when opening the download dialog.

Here is my code:

$("input:checkbox").click(function () {
    if ( $("#checkbox_1").is(":checked") && $("#checkbox_2").is(":checked") ) {
        $("#download_button").removeAttr('disabled');
    } else {
        $("#download_button").attr('disabled', 'disabled');
    }
});

      

Thanks everyone.

+3


source to share


1 answer


When you click the checkboxes it will disable the button. When you load a new dialog box, you load a new, non-disabled button. You need to run your code again after the dialog has been loaded to disable the button again in order to do this. In the code of the dialog you want to add:



<script>

    if ($("#checkbox_1").is(":checked") && $("#checkbox_2").is(":checked"))
        $("#download_button").removeAttr('disabled');
    else
        $("#download_button").attr('disabled', 'disabled');
</script>

      

+1


source







All Articles