3

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.

peterh
  • 11,875
  • 18
  • 85
  • 108
Roger Williams
  • 159
  • 2
  • 7
  • 15

1 Answers1

7

Are you using firefox? You may want to disable autocomplete: autocomplete = "off" in your button/inputs. Edit: see the SO question I linked to in the comments.

Cianan Sims
  • 3,419
  • 1
  • 21
  • 30