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

73
Visualizações
Pass two variables in a javascript created onchange

I am using DataTables and have a checkbox. On change I trigger a function. I want to pass two variables to the function like so:

{data: null,
      className: "center",
      render: function(data,type,row) {
            alert(data.sesId);
           if(data.checkedIn === "N"){
               return ("<input type='checkbox' id=" + data.patId + " name='update' onchange='patientCheckInFunction(this," + data.sesId + ")' style='zoom: 2.0;'>");
           }else{
               return ("<input type='checkbox' id=" + data.patId + " name='update' onchange='patientCheckInFunction(this," + data.sesId + ")' style='zoom: 2.0;' checked>");
           }
        },
},

This gives me an "Unexpected token ')'" in the console log.

There is no error if I have:

return ("<input type='checkbox' id=" + data.patId + " name='update' onchange='patientCheckInFunction(this)' style='zoom: 2.0;'>");

However, I do want to pass both variables.

about 4 years ago · Juan Pablo Isaza
2 Respostas
Responde à pergunta

0

Try like this:

return ("<input type='checkbox' id='"+ data.patId +"' name='update' onchange='patientCheckInFunction(\"" + this + "\",\"" + data.sesId +"\")' style='zoom: 2.0;'>");
about 4 years ago · Juan Pablo Isaza Relatório

0

I was not using "name" so I ended up doing this:

return ("<input type='checkbox' id=" + data.patId + " name=" + data.sesId + " onchange='patientCheckInFunction(this, this.name)' style='zoom: 2.0;'>");
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