Is there another way to get an DOM element's ID?
element.getAttribute('id')
Yes you can just use the .id property of the dom element, for example:
.id
myDOMElement.id
Or, something like this:
var inputs = document.getElementsByTagName("input"); for (var i = 0; i < inputs.length; i++) { alert(inputs[i].id); }
1.4m articles
1.4m replys
5 comments
56.9k users