//Try this var e = document.getElementById("your-elements-id"); var data1 = e.getAttribute("data-yourData"); var data2 = e.dataset.yourdata;