Obtener array con los valores de checkbox


/ Published in: jQuery
Save to your folder(s)

Uso de map y function(i,n)
Devueve un array valor1, valor2, ...


Copy this code and paste it in your HTML
  1. var checkbox_opciones = $('#opciones input:checked').map(function(i,n)
  2. {
  3. return $(n).val();
  4. }).get(); //get converts it to an array

Report this snippet


Comments


You need to login to view comments.