dialog in jquery tab only works first time

dialog in jquery tab only works first time

I have a dialog that opens from inside a tab. Everything works great until I change tabs and come back. the second time I visit the tab and open the dialog my javascript does not work. I can retrieve the data from the form but its the old data from the last time it was open. the ajax does not submit and if I try debugging with firebug I see this error:

uncaught exception: [Exception... "Component returned failure code: 0x8000ffff (NS_ERROR_UNEXPECTED) [nsIDOMHTMLDocument.implementation]" nsresult: "0x8000ffff (NS_ERROR_UNEXPECTED)"


When I close the dialog I am only using

$(this).dialog('close');


I read that I need to use remove in addition to close or destroy;

so I have tried using :
$(this).dialog('remove');
$(this).dialog('close');


as well as destroy and I get the same results.

Anyone have any suggestions?