Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

255
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda