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:
myDOMElement.id
Or, something like this:
var inputs = document.getElementsByTagName("input");
for (var i = 0; i < inputs.length; i++) {
alert(inputs[i].id);
}