New course! Every coder should learn Generative AI!
Try a free lesson+ 3
I'm not sure what you are achieving but you can simply target a class attribute this way:
document.getElementsByClassName("your_class")[0]; to target first element. (In classes there can be many elements of the same class)