I'm trying to access the 'data-*' attributes on an element in the browser in Haxe.
var element = document.getElementById('#someId');
var dataLabel = 'label'; //'data-label'
element.dataset[dataLabel] = 5;
That code (which works in plain javascript) generates two compilation errors in HaxeDevelop.
"String should be Int"
"For function argument 'data'"
How can I access element datasets in Haxe? Is there a known proper way to do it?
I ended up using the Element#getAttribute and Element#setAttribute methods to accomplish the same functionality.
var element = document.getElementById('#someId')
var dataLabel = 'label'; //'data-label'
element.setAttribute('data-' + dataLabel, 5);