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?

#132424
SgtLegend
Member

Using the `attr` method in jQuery for `data-` attributes is technically correct but its recommended you use the `data` method which is designed for HTML5 data attributes, see the below example:

out.push($(this).data(‘customerid’));