[Dart] Access HTML Data Attribute


Explain by example, if you have following element in HTML:

<div id="myDiv" data-my-demo-value="value"></div>

Access the value by dataset property:

var value = querySelector("#myDiv").dataset["myDemoValue"];

References:

[1]HTML Global data-* Attributes - W3Schools
[2]Getting HTML5 data-* attribute with Dart - Stack Overflow
[3]dataset - dart:html.Element API Docs
[4]Google search : HTML Data Attribute
[5][Golang] GopherJS DOM Example - Access HTML Data Attribute