Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Unable to set 'data' attribute for 'Object' tag in jQuery. [IE8 only]

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?

like image 774
ipradhansk Avatar asked May 03 '13 22:05

ipradhansk


1 Answers

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.)

like image 60
jdigital Avatar answered Oct 02 '22 17:10

jdigital