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

284
Vistas
Using Jquery, hide a div that is not existing yet, but will exist

I want to hide a div using JQuery on click event of another div. The problem is that the div that I want to hide is actually created only when I click on the existing div.

Let me explain with code example:

HTML:

<div class="first">I already exist and I create the second div when I am clicked</div>
<div class="second">I do not exist yet, I am created when first div is clicked</div>

The above is happening by another piece of code that another developer wrote.

I want to write another piece of code that will hide the second div when its created right after first div is clicked.

I do not have the permission to change the original dev's original code.

My JQuery that is not working:

$(".first").on("click",function() {
    $(".second").hide();
});
about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

You should use this, cause you have to make this delegate. explanation: https://api.jquery.com/on/

$("body").on("click", ".first",function() {
    $(".second").hide();
});
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