0

I have iFrame which looks like this:

<iframe id="iFrame" scrolling="no" name="iFrameTarget">
#document
<head></head>
<body>
    <div id="content">
        <form id="#myForm"></form>
    </div>
</body>
</iframe>

and I'm trying to change css style of element inside body #myForm I tried this but it didnt help:

$(document).ready(function () {
    $('iframe').contents().find("form").first().css('max-width', 'none');
});

Is there other solution to do this ?

LDropl
  • 846
  • 3
  • 9
  • 25
  • Is the iframe content being served from the same domain as the outer page? Also, `none` isn't a valid value for `max-width`. You may want `initial` or `inherit` depending on your HTML structure and goal. https://developer.mozilla.org/en-US/docs/Web/CSS/max-width – Rory McCrossan Dec 02 '20 at 13:58
  • I just checked again the iframe is not from same domain, inherit doesnt work also – LDropl Dec 02 '20 at 14:18
  • 1
    'the iframe is not from same domain' this is your problem in that case. You cannot amend the content of a cross-domain iframe for security reasons. What you're attempting to do is not possible. – Rory McCrossan Dec 02 '20 at 14:20

0 Answers0