Quote the keys with the hyphens in the object, as hyphens are not valid in object keys
$( "#test" ).attr({
'data-ids' : '5sH7qfUk5T',
'data-fields' : 'firstName,lastName,industry, location'
});
The Property Identifier type is used to associate a property name with a Property Descriptor.
Values of the Property Identifier type are pairs of the form (name, descriptor), where name is a String and descriptor is a Property Descriptor value.
When you use the hyphen character outside string literals it's interpreted as a 'minus' sign, and so it's not valid in object keys that are not quoted.