Cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Add data attribute to button

Hey guys,

 

Is it possible to add a data-attribute to a button and retrieve that value? Something like:

```

<use id="btn1" data-value="hello" href="#icon-button" class="large-button application-fill plus-button" />

btn1.addEventListener("click", (evt) => {
console.log(this.value); // should print "hello"
});
```

Thanks in advance! 🙂
Best Answer
1 REPLY 1

I would find this useful. Could I suggest that post your suggestion here too?

Peter McLennan
Gondwana Software
Best Answer
0 Votes