Reputation: 7102
what is best practice when it comes to closing a jQuery UI dialog box? I use a dialog box so the user can perform a search.
When the user is finished, should I use .close() or .remove()?
My concern is, what if they decide to perform another search...would it be better to haved closed or removed the old one?
Thanks!
Upvotes: 0
Views: 38
Reputation: 15397
Closing and showing is much faster than removing and recreating, but if it matters to you, any previous user input will still be in the dialog if you simply save it and show it.
In my experience, the best thing to do is keep the dialog around, and initialize it before (re-)opening it. This way, you keep adding or removing from the DOM to a minimum, and the initialize step gives you a chance to make sure the user sees what they're expecting to see.
Upvotes: 1