Reputation: 116950
I have the following usecase:
The problem is that when the popup comes in, the user is still able to click on the background buttons. At this point, I can remove the entire DIV temporarily but I don't want to do that. Is there anyway I can disable all the previously attached events and then add event handlers ONLY to the current popup? (I mean something like a close button should still work on a popup) Any suggestions?
Upvotes: 1
Views: 1961
Reputation: 3276
You can use the modal dialog option built into JQuery UI
http://jqueryui.com/demos/dialog/#modal
$("#dialog-modal").dialog({
modal: true
});
Upvotes: 1
Reputation: 8765
You could store each element with an attached event into an array, then loop through them and unbind()
them. Upon closing the popup you can re-bind()
them.
Upvotes: 1
Reputation: 180868
Sounds like you need a modal popup. There are numerous jQuery plugins that do that, or you can check out this tutorial.
Upvotes: 1