klewis
klewis

Reputation: 8350

Removing attribute from iframe with jQuery

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

Upvotes: 0

Views: 5297

Answers (2)

castillo.io
castillo.io

Reputation: 942

Absolutely. With jQuery:

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

See example here:

http://jsfiddle.net/3rFTF/

Upvotes: 1

Diodeus - James MacFarlane
Diodeus - James MacFarlane

Reputation: 114367

Put an ID on your iframe to make it easy:

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

Upvotes: 8

Related Questions