0
Hey, how you doing? I would like to store in a variable, among several classes of this example, the class that begins with SHOWCASE. I don’t want to store html. I want to store the class name!
<a class = "classe1 classe2 vitrine-12457" href="link01">Conteudo 1</a>
<a class = "classe1 vitrine-12458 classe3" href="link02">conteudo 2</a>
<a class = "classe1 vitrine-12459 classe3 classe4" href="link03">Conteudo 3</a>
My goal is for example, through script, to create a new element and give an append by placing it inside the tag < a > repeating the respective link of each tag. The result would be + - like this:
<a class = "classe1 classe2 vitrine-12457" href="link01">Conteudo 1
<span href="link01">
conteudo do span
</span>
</a>
<a class = "classe1 vitrine-12458 classe3" href="link02">conteudo 2
<span href="link02">
conteudo do span
</span>
</a>
<a class = "classe1 vitrine-12459 classe3 classe4" href="link03">Conteudo 3
<span href="link01">
conteudo do span
</span>
</a>
In my reciocínio... storing the only class that differs from the others, I can pass it to Jquery by agglutination and so, both get the href and the correct element and Assign to a child, the same href of the Father element.
Thanks for your help!
But will you do a query to find an element and store the class name to then do another query to find again the element you had already found? Put the code you intend to use with a comment on the missing part.
– Andre
Your question is unclear. Please explain better what you want to do (try using other words).
– Luiz Felipe
I edited it! I think it’s clearer... ^^'
– Ivan Gomes