enable the button to be clicked only to once exception?

jQuery provides the one() method to register a one-shot handler that will only run once.

You can write:

$("#yourButton").one("click", function() {
    // Add content...
});

You can disable the button once it was clicked to prevent any further clicks:

$('button').on('click', function() {
    $(this).prop('disabled', true);
});

Here is my suggestion. If you are destroying the dialog on exit, just unbind the click event

$('.my-button').on('click', function(){
    // process code
    $(this).off('click');
});

You can read about off here

And here is a demo. First will not allow other clicks but the second will.

source