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?
April 19, 2013 at 7:27 am
#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’));