I need to check if the parent element is a span. How can I do that using Javascript (not JQuery)?
element.parentNode.tagName.toLowerCase() == 'span'
var elem = document.getElementById("myElement"),
isParentSpan = elem.parentNode.tagName === "span";
alert( isParentSpan );
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