3
I’m trying to find a li
with a certain class (selected
), however, I haven’t been able to find the id
hers.
Here’s the code
var slide_act = $(".bull").find("selected").attr("id");
console.log(slide_act);
On the console appears undefined
when I perform the function of click
. Any explanation?
Additional Code
<ul class="bullets">
<li class="bull selected" id="slide1"></li>
<li class="bull" id="slide2"></li>
<li class="bull" id="slide3"></li>
</ul>
Post the html so we can help you
– Caique Romero
@Caiqueromero Sorry, edited.
– I_like_trains
because you don’t look right for the class
selected
thus :var slide_act = $(".selected").attr("id");
?– Vinicius Shiguemori
@Viniciusshiguemori This results as a temporary response, but this class may be associated with other things, so I just wanted to select those that also had the class
.bull
– I_like_trains
Also missing a point
.
in thefind("selected")
– Sam