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

120
Views
Imported JQuery Code Not Affecting React Component

I'm using an old-school payment portal in my React app which requires that their JQuery script is imported to properly render an iFrame widget.

I went into my index.js file in public folder and added the script into the head:

<script type="text/javascript" src="https://vendorUrl.com/popup.js"></script>

Among other things, the referenced script ensures that the iFrame is hidden at launch until a button is clicked:

jQuery(document).ready(function () {
    var iframe = document.getElementById("SpecificIFrame");

    ...
    iframe.style.opacity = 0;
    iframe.style.transition = 'opacity .5s ease-in-out';

    jQuery(".show-popup").on("click",
        function (e) {
            e.preventDefault();
            openPopup();
        });
});

function openPopup() {
    var iframe = document.getElementById("SpecificIFrame");
    iframe.style.opacity = 1;
    iframe.style.width = '100%';
    iframe.style.height = '100%';
    ...
}

So, when in my functional component I create the iFrame, I'm surprised to see that it's visible and ignores all the jQuery code in the external script.

import $ from "jquery";

export default function MyComponent() {
    return(
        <>
            <iframe 
                id='SpecificIFrame' 
                src='https://myUrl.com/...'>
            </iframe>
            <button className='show-popup'>Pay via Platform</button>
        </>
    )
}

Why is the script being ignored? What can I do to fix this please?

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!