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

221
Vistas
document.getElementById('pwMeter').style.display='none' not working as expected

I'm trying to hide a div using the following method in a react web page. But it doesn't hide the element. I can't see any errors in the developer tools as well.

if(pw.length==0){
  document.getElementById('pwMeter').style.display='none'  
}

What is the problem here? Does React support this method?

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

yes with react you can do this , check this sample ref code for that

import { useState } from "react";

const TestFunction = (props) => {
  const [pw, setpw] = useState(["test"]);
  return (
    <div>
      <div
        id="pwMeter"
        style={pw && pw.length > 0 ? { display: "bock" } : { display: "none" }}
      >
        <p>test data</p>
      </div>
    </div>
  );
};

export default TestFunction;
about 4 years ago · Juan Pablo Isaza Denunciar
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