This should save the x/y position of a canvas click to the canvas element as data attributes, but for some reason, they do not appear in the HTML when i inspect it with Chrome.
$('#canvas').click(function(e){
$(this).data("pos-x", e.offsetX);
$(this).data("pos-y", e.offsetY);
});
If i add a console log prior to this.data, the values are there, are they are not empty, what seems to be the issue?
It seems very straight forward, so i have a hard time seeing the problem.