Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

72
Views
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 answers
Answer question

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 Report

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!