JS is not my main skill, hope someone can help. I am trying to make a GTM variable to extract . Problem is that I cant use as a class name because it changes based on the truck type that is viewed (trailer, truck, etc)
Thank you!
CodePudding user response:
You can extract the title. You just have to scramble through.
t = document.querySelector('#scheduleContainer svg title').innerHTML
console.log(t)
<div id="scheduleContainer">
<div>
<div>
<svg>
<title>Hello</title>
<path>
</svg>
</div>
</div>
</div>
CodePudding user response:
try getElementsByTagName() click here for the docs.
CodePudding user response:
in javascript, using document.title
should be enough