Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

109
Vistas
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
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda