As mentioned in the comments by adeneo and Banana, the first and the last should not work. Attempted both in a jsFiddle and both threw errors. This is because .dataset
is not within jQuery. You must have code internally or externally adding dataset to that jQuery object.
the following are similar syntax but should work (where with only the details you gave, your code shouldn’t work):
document.getElementById("id").dataset.assoc
$("#id")[0].dataset.assoc
This is due to data-* attributes in HTML5.
2
solved HTML 5 dataset issue