Need to add a CSS class/ID in a dynamically generated content. The following fiddle is a sample format which is dynamically generated.
https://jsfiddle.net/g092zo3p/
<ul>
<li><a href="#">Tab</a></li>
<li><a href="#">Video</a></li>
<li><a href="#">Accessory</a></li>
</ul>
I cannot edit the generated HTML. Hence I want to add a class to <li>
via javascript. The class name should be the content inside the <a>
link. Lets say in the first two <li>
I want to add a class name which is the same as the content within the <a>
tag.
e.g., <li class="Video"><a href="#">Video</a></li>
I tried search for it on good and all.
Thank you.