I have an span tag in my document. I'd like to access it's name property, but it doesn't seem to be there. According to MDN Element Name the name property doesn't apply to a span.
That being said the document.getElementsByName returns my span by name.
Assuming you already have a reference to your span handy, just use Element.getAttribute()
.
console.log(mySpan.getAttribute('name'));
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With