Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums JavaScript How to get “data-” values under ul tag into a comma separated list? Re: How to get “data-” values under ul tag into a comma separated list?

#132392
Merri
Participant

One solution, there may be more elegant ways to do this:

var out = [];

$(‘#myList a’).each(function(){
out.push( $(this).attr(‘data-customerid’) );
});

var commas = out.join(‘,’);

.