Ver Mensaje Individual
  #2 (permalink)  
Antiguo 16/02/2016, 14:28
Avatar de andresgarciadev
andresgarciadev
 
Fecha de Ingreso: junio-2013
Mensajes: 218
Antigüedad: 10 años, 10 meses
Puntos: 32
Respuesta: Recoger valores de un Array

pienso que seria algo asi
Código Javascript:
Ver original
  1. jQuery(document).ready(function($) {
  2.     $('.referencia').each(function() {
  3.         $(this).popover({
  4.             html: true,
  5.             trigger: 'manual',
  6.             content: function() {            
  7.               var myRel = $(this).attr("rel");
  8.                var myRefe = "";
  9.               //Detectamos si hay coma
  10.               if(myRel.indexOf(',') != -1){
  11.                 //Convertimos la cadena en array
  12.                 var myRel_array = myRel.split(",");
  13.                 //agregamos #ref a cada elemento del array
  14.                 for(var i=0;i<myRel_array.length;i++) {
  15.                     myRefe += $("#ref"+myRel_array[i]).html();
  16.                     }
  17.                 }
  18.               else {
  19.                 //Si solo es un número
  20.                 myRefe = $("#ref"+myRel).html();
  21.                 }
  22.                 return myRefe;
  23.             }
  24.         })
  25.     });
  26. });