I need to create and remove YUI charts from a page. To remove, I am doing $('.chart').remove() to get rid of the containing DIV. However, this raises a null reference exception in this script: try { document.getElementById("yuiswf1").SetReturnValue(_flash_toXML(YAHOO.widget.SWF.eventHandler("yuiswf1",({category:"info",message:"resize (width: 0, height: 0)",type:"log"}))) ); } catch (e) { document.getElementById("yuiswf1").SetReturnValue("" + e + ""); }
I assume YUI attaches this code for some event handler which is failing since the DIV has been removed.
How can I remove a YUI chart without causing this exception?