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

183
Vistas
Object.click() isn't working for label tag

I have a data set that I loop through and make rows of checkboxes along with other data. The user should have the ability to click on the checkbox to toggle whether something else should be showing. For some reason, $('label').click() never gets called. Code:

    let i = 0;
    data.forEach((row) => {
      myTable += "<tr>" + "<td>" + `<label id="label" for=` + String(i) + `><input type="checkbox" id=` + String(i) + `><span> Not showing</span></label>` + "</td>"+ "<td>" + row.name + "</td>" + "<td>" + app.nations[row.nation] + "</td></tr>"
      $('label').click(function() {
        console.log("Clicked");
        var checked = $('input').is(':checked');
        $('span').text(checked ? ' Showing' : ' Not showing');
      });
      i += 1;
    });

Thanks!

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