March 20, 2012
appending an <object> dynamically in IE doesn't work
Question by CCrawler
I tried several methods, none seem to work:
1 (I tried this one with other elements and it doesn’t work either):
$('#container').append('<object attribute="value"></object>');
2 (I found that this way worked with IE with most elements, but no luck here) :
var newSwf = $('<object></object>').attr('attribute', 'value');
$('#container').append(newSwf); //appendTo doesn't work either
None of the above seems to have any effect on the DOM, like nothing is appending at all. I know IE works funny with the append function, but until now, I always managed to find a workaround. I have no clue with this one though. Any ideas?
EDIT:
It seems it was my mistake, something else on my code was causing the problem in IE. I’m terribly sorry, I was hiting against a wall and I thought it was some sort of .append() issue, since IE always works funny with that.
The second method worked, as it does with other elements.