Reputation: 159
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 class="rg-trailer-icon" as a class name because it changes based on the truck type that is viewed (trailer, truck, etc)
Thank you!
Upvotes: 0
Views: 227
Reputation: 17566
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>
Upvotes: 1