How to remove scroll from iframe using jquery?

I have a page to which I do not control the source. It contains an iframe. The iframe has scrollbars and a border. I want to remove both. I tried using jquery as follows:

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

Nothing will affect iframes attributes at all.

Any ideas? (IE8)

+5
source share
4 answers

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

<iframe scrolling="no" frameborder="0">
+1
source

You can access iframe attributes using jQuery and just set the scroll to no as follows:

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

Just add [0] as above so that the jQuery object returns the first DOM element.

+1

frameborder="0" , . css , .

0

.

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

I have not tested it, but it should work.

0
source

Source: https://habr.com/ru/post/1757042/


All Articles