Answers for "javascript to get element by attribute"

15

javascript get attribute

//HTML
//<div id="elem" data-id="4hJ3s"></div>

var elem = document.getElementById("elem");
elem.getAttribute("data-id"); // "4hJ3s"
Posted by: Guest on May-20-2020
0

find input by value attribute javascript

document.querySelectorAll("input[value=something]");
Posted by: Guest on January-28-2021

Code answers related to "javascript to get element by attribute"

Code answers related to "Javascript"

Browse Popular Code Answers by Language