Setup:
I have a variable called tabcontent
containing an HTMLCollection with items called Drums
and Animals
inside it. I also have a variable called activeTabName
that is accessing the innerHTML of whatever tab I currently have open. It can equal either Drums
or Animals
. For simplicity I just made it directly equal Drums
.
var activeTabName = "Drums";
console.log(tabcontent.Drums); // Prints Drums portion of HTMLCollection
console.log(tabcontent.activeTabName); // Prints undefined
Question:
How do I access HTML attributes with my variable activeTabName
? Also, why is tabcontent.activeTabName
undefined?