html - Getting innerHTML from an [object, HTMLUnknownElement] with JavaScript (No JQuery) -
so, i'm writing script finds elements tagname of ui
, , prints console content inside of tags:
<ui>content_here</ui>
i using following code perform action.
var e = document.getelementsbytagname('ui'); (var = 0; < e.length; i++) { if (e[i].tagname.tolowercase() === 'ui') { console.log(e[i].innerhtml()); } }
for code, given error:
e[i].innerhtml not function(...)
on printing out e[i]
on own, given <ui>content_here</ui>
output.
what take content inside of tags , print screen?
note - have tried using .html()
, .value()
also.
no jquery please. thanks.
just remove parenthesis access property.
console.log(e[i].innerhtml); // ^^
var e = document.getelementsbytagname('ui'); (var = 0; < e.length; i++) { if (e[i].tagname.tolowercase() === 'ui') { console.log(e[i].innerhtml); } }
<ui>content_here</ui>
Comments
Post a Comment