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

256
Vistas
ajax - Why onclick doesn't work with checkboxes

I am currently creating tables and checkboxes using ajax communication.

After it was created, it was confirmed that the checkbox function was working normally, Even if I include checked while creating it, the onclick function doesn't fire.

success:function(data){
    for (var key in data) {
        feature = data[key]
        head = feature[0].split(" ")
        tail = feature[1].split(" ")
        type = feature[2]
        name = feature[3]
        $('#pharmacophore_table').append("<tr>" + 
            "<td>" + name + "</td>" +
            "<td> <label><input type='checkbox' name='ligand_feature' onclick='show_ligand_feature(this, " + '"' + feature + '"' + ");' ></label>" + 
            "</tr>");

        $("input[name='ligand_feature']").attr( "checked", true);
    }      
},
error:function(data){
    alert(data.status)
}

How can I solve this?

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

0

I solved it.

Just add click event

complete: function(){
    var chck = document.getElementsByName('ligand_feature')
    for (var l=0; l<chck.length; l++){
        chck[l].click();
    }
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