Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

261
Views
Add Custom Style In Iframe using jQuery

I am using Clutch widget in my website page https://staging-outpaceseo.kinsta.cloud/services/law-firm-seo/ for some credibility. And the iframe has its pre-defined CSS that I need to override. I tried add the style tag inside the iframe using jQuery, but it is not working.

Webpage: https://staging-outpaceseo.kinsta.cloud/services/law-firm-seo/ Script:

<script>
            $(document).ready(function() {
                const id = $('.clutch-widget iframe').attr('id');
                var iframe = document.getElementById(id);
                var style = document.createElement('style');
                style.textContent =
                    '.carousel_widget__wrapper, .carousel_widget {' +
                    '  background: #ffffff;' +
                    '}' 
                ;
                console.log(id, 'id')
                console.log(iframe, 'iframe')
                console.log(style, 'style')
                console.log(iframe.contentDocument, 'iframe.contentDocument')
//              let head = iframe.contents().find('head');
//              head.append(style);
                iframe.contentDocument.head.appendChild(style)
            });
        </script>

You can check the page console to check the output of above console logs. Instead of adding the style tag to the clutch iframe, i think new iframe is being created and the style tag is added there. enter image description here

about 4 years ago · Santiago Trujillo
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!