Jason
Jason

Reputation: 4144

JQuery Event On Clearing A Div

I have a div that is used to display one of several wizard interfaces; which wizard is dependent upon a menu selection.

Unfortunately, if a user clicks a different menu option, the div is cleared and the new wizard is displayed. There is no chance to clean up the session (which I am using as a conversation scope).

Is there a way to trap the jquery .empty() command, in order to make sure I can clean up any mess before new content is displayed?

Upvotes: 0

Views: 52

Answers (1)

nettutvikler
nettutvikler

Reputation: 604

With no real code it's hard to answer, but as I can see in docs empty() has no method for binding another function (http://api.jquery.com/empty/) - so my suggestion is to write own function for clearing and allow it's manipulation.

Another way could be with some "dirty form" handling (check if form changed and allow/disallow etc).

Upvotes: 1

Related Questions