0

Is it possible to remove width attribute from an < iframe width="100%" >, with jQuery, either when the DOM is ready or on window.load?

Thanks

klewis
  • 7,459
  • 15
  • 58
  • 102
  • Its been awhile, but windows load event did the trick for me and the answers here dont mention it - https://stackoverflow.com/questions/5788499/jquery-iframe-load-event – Marvel Moe Nov 01 '22 at 17:17

2 Answers2

8

Put an ID on your iframe to make it easy:

$(document).ready(function() {
    $('#myFrame').removeAttr('width');
})
Diodeus - James MacFarlane
  • 112,730
  • 33
  • 157
  • 176
1

Absolutely. With jQuery:

$(document).ready(function() {
    $('iframe').removeAttr('width');
});

See example here:

http://jsfiddle.net/3rFTF/

castillo.io
  • 942
  • 7
  • 9