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?
.data()which isn't used for settingdata-*attribute