example <button data-keyname = "a'></button> let variable = element.dataset.keyname; or let varibale = element.['keyname']; or let variable = element.getAttribute('data-keyname');