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

283
Views
Cómo pasar múltiples argumentos en un solo método Javascript usando thymeleaf onclick (th:onclick)

Intenté la siguiente sintaxis pero no funcionó para mí. Por favor, hágamelo saber la respuesta.

Código JavaScript --->

 function passValue(id, name){ console.log(id) console.log(name) document.getElementById("updateId").value=id; }

Código de hoja de tomillo -->

 <input type="button" th:onclick="passValue(\''+${data.id}+'\', \''+${data.newEntryName} +'\')" value="Update" />

Me muestra un error como:

Error de sintaxis: símbolo inesperado.

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Te recomiendo que hagas argumentos de JavaScript como este (observa que estoy usando onclick y no th:onclick ):

 <input type="button" th:data-id="${data.id}" th:data-name="${data.newEntryName}" onclick="passValue(this.getAttribute('data-id'), this.getAttribute('data-name'));" value="Update" />
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!