Javascript - get data attribute

getAttribute

let data = document.getElementById("hello").getAttribute("data-hello");

dataset property — part of the new HTML5 JavaScript API. It will return a DOMStringMap object of all the selected element’s data- attributes.

let data = document.getElementById("hello").dataset.hello;