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

114
Views
How to hide element in iframe that appears on both the main site and within the iframe

The help button appears on the webpage, when you click on the help button, it opens an iframe which is the same webpage in a smaller window(iframe).

How do I hide the help button only in the iframe so that another iframe cannot be opened within the iframe.

I have tried query selectors and DOM selectors, but they are not working

xport default function help() {
  const [shown, setShown] = React.useState(false)

//   var myIframe = document.getElementById("iFrameContainer");
//   var divElement = myIframe.contentWindow.document.querySelector(".helpButton");
//   divElement.style.display = "none";

  return (
    <div className="helpButton">
      {shown ? <Helper src="http://localhost:3000/"/> : null}
      <button onClick={() => setShown(!shown)}>
        <img src={helpIcon} alt=""/>
      </button>
    </div>
  );
  
}



const Helper = (props) => {

  // var myIframe = document.getElementById("iFrameContainer");
  // var divElement = myIframe.contentWindow.document.querySelector(".helpButton");
  // divElement.style.display = "none";

  return <div name="iFrameContainer">
    <iframe
      className='frame'
      title={props.src}
      src={props.src}
    />
    </div>
}
about 4 years ago · Juan Pablo Isaza
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!