I want to set the data attribute for a tag (like data-id="..") using the following way:
$('<p>', {text: 'bla', data-?: '..'}).appendTo('#tagToAppendTo');
Unfortunetaly, I am not able to define the custom part (here marked as ?) in the object. Is there a way to do it like this, or do I need to resort to the .data() function?
', {text: 'bla', 'data-test': 'some value'}).appendTo('#tagToAppendTo');?! Is that your issue?
– A. Wolff Dec 01 '17 at 10:28