I have a button on a page:
<button class="" id="new_cat_charm">Add New Category</button>
I am using jquery to open a dialog box when the button is clicked and to add an overlay to the site:
jQuery( document ).ready( function( $ ) {
var newCatButton = $( '#new_cat_charm' );
newCatButton.click( function(){
var newCatCharm = $( '#new-cat-charm' );
newCatButton.prop( 'disabled', true );
newCatCharm.removeClass( 'myhide' );
appOverlay();
});
function appOverlay() {
var docHeight = $(document).height();
$("body").append("<div id='overlay'></div>");
$("#overlay").height(docHeight).css({
'opacity' : 0.4,
'position': 'absolute',
'top': 0,
'left': 0,
'background-color': 'black',
'width': '100%',
'z-index': 5000
});
}
});
After the button has been clicked I disable it and show the dialog box.
The problem
After I click on the button and it becomes disabled and the dialog box pops up, if I refresh the page the button remains disabled and I have to either do a force reload (ctrl+f5) or click inside the address bar of the browser and press enter before it returns to normal.