1

I have the following HTML tag:

<object type="text/html" data="/page.html"></object>

I need to strip out an element from the HTML that is being generated. I try with this:

var mainFrame = '<object type="text/html" data="/page.html"></object>'; 
html = $.parseHTML(mainFrame),
console.log(html);

but i'm only getting an object containing:

<object data="/page.html" type="text/html"></object>

UPDATE

I'm expecting to get the page.html HTML. Like:

<html>
    <head></head>
    <body>
        <div id="elementToStripOut"></div>
    </body>
</html>

Then I need to remove the div #elementToStripOut.

Rory McCrossan
  • 331,213
  • 40
  • 305
  • 339
Mark
  • 645
  • 2
  • 9
  • 27

1 Answers1

0

I've never done this with <object> but assume principles should be the same as with an <iframe>

$('object').on('load',function(){
    $(this).contents().find('#elementToStripOut').remove();
});
charlietfl
  • 170,828
  • 13
  • 121
  • 150