Answers for "html data attribute havascript"

5

html javascript find data attribute

//javascript get html data attribute
<button data-id="1" >Click</button>
<button data-id="2" >Click</button>
<button data-id="3" >Click</button>
const btns=document.querySelectorAll('button[data-id]');
[...btns].forEach(btn => console.log(btn.getAttribute('data-id')))
Posted by: Guest on July-25-2020
-2

get data attribute javascript

Get data attribute
Posted by: Guest on June-13-2021

Code answers related to "Javascript"

Browse Popular Code Answers by Language