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

210
Vistas
Error: Uncaught SyntaxError: missing ) after argument list - JS function

I used arrays for my table :

var html = [];
$.each(data,function(index,item){
   no++;
   var arr = [
    '<tr>',
       '<td>'+ no +'</td>',
       '<td>'+ item.name +'</td>',
       '<td>'+ item.address +'</td>',
       '<td>',
         '<button type="button" class="btn btn-info btn-sm" onclick="pickData('+ item.id +','+ item.name +','+ item.address +')"><i class="fas fa-plus-circle"></i></button>',
    '</td>',
    '</tr>'
    ].join('\n');
    html.push(arr);
});
$('#table').html(html);

and this is the function :

function pickData(id, name, address) {
    $("#id").val(id);
    $(".name").val(name);
    $(".address").val(address);
}

The error is :

Uncaught SyntaxError: missing ) after argument list

Where is the problem?

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

0

From the way you write code, Please check your variable (especially address and name) value from console.log, Make sure it doesn't contains space on it.

Ie. "Malibu" Vs "Malibu street",

If it does contains space, you need to quotes those variable value. Because when you're not place quotes, your function would be invoked like this: pickData("yourId", "yourName", Malibu street)

Meanwhile the function itself expect like this: pickData("yourId", "yourName", "Malibu street")

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