Read HTML Data Attribute

Read a data- attribute from an HTML element

by @todd

How to Use

You can use this brick to read a data-* attribute from an HTML element. Just provide a selector for the element, and the name after the "data-" prefix

For example, to read the id, you would provide "id" for the attribute:

<div data-id="123456">
  Hello World!
</div>

Inputs

Name Required Type Description
selector string
attribute string The data attribute, without the leading data-. For example: id for data-id

Outputs

Name Required Type Description
No outputs for this brick defined.

Related Tags