11

[Dart] Access HTML Data Attribute

 2 years ago
source link: http://siongui.github.io/2015/03/01/dart-access-html-data-attribute/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

[Dart] Access HTML Data Attribute

March 01, 2015

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


Author: Siong-Ui Te Category: Dart

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK