Javascript – How to change/replace a flash object with jquery or pure javascript

flashjavascriptjquery

I want to change a flash object enclosed within with jQuery after an onClick event. The code I wrote, essentially:

$(enclosing div).html('');
$(enclosing div).html(<object>My New Object</object>);

works in Firefox but not in IE. I would appreciate pointers or suggestions on doing this. Thanks.

Best Solution

The empty() method is the better way of deleting content. Don't know if that will solve your problem though :)

$('#mydiv').empty();

You could also try the replaceWith(content) method.