Javascript – Unable to set ‘data’ attribute for ‘Object’ tag in jQuery. [IE8 only]

htmlinternet-explorerinternet-explorer-8javascriptjquery

I am creating an object element dynamically in jQuery, to render some content. It works in all browsers except IE8.

The code:

    j$(document).ready(function(){ 
        j$('.objContainer').html(j$('<object>').attr(
                            {'data':'http://www.stackoverflow.com',
                             'type':'text/html'}));
    });

The HTML structure created after the execution(in IE8):

    <object type="text/html"></object>

In other browsers[IE9, Firefox, Chrome]:

    <object data="http://www.stackoverflow.com" type="text/html"></object>

Any solutions?

Best Solution

Works for me: using the IE8 developer tools, I can see the data attribute. Here's a screenshot.

(I know I shouldn't have to say it, but: you need to make sure that you're allowing scripts to run.)