CraigF
CraigF

Reputation: 65

How can I remove scrollbars from an iframe using jquery?

I have a page that I don't control the source to. It contains an iframe. The iframe has scrollbars and a border. I want to remove both. I tried using Jquery like this:

$('iframe').attr('scrolling', 'no');

Nothing I do will affect the iframes attributes at all.

Any ideas? (IE8)

Upvotes: 5

Views: 3534

Answers (4)

Cybernetic
Cybernetic

Reputation: 13334

You can access the iframe's attributes using jQuery, and simply set the scrolling to "no" like this:

$("#frame")[0].setAttribute("scrolling", "no");

Just be sure to append the [0] as above, so the jQuery object will return the first DOM element.

Upvotes: 1

Akshay
Akshay

Reputation: 354

Try this.

$("iframe").each(
     function(index, elem) {
         elem.setAttribute("scrolling","no");
     }
 );

I didn't test it but it should work.

Upvotes: 0

David Hellsing
David Hellsing

Reputation: 108500

http://www.w3.org/TR/html4/present/frames.html#h-16.5

<iframe scrolling="no" frameborder="0">

Upvotes: 1

meder omuraliev
meder omuraliev

Reputation: 186662

frameborder="0" I believe for the border part. You could play around with css overflow for the scrolling, not exactly sure about that.

Upvotes: 0

Related Questions