Reputation: 932
I have the following code
$("#accordian h3").click(function(){
$("#accordian ul ul").slideUp();
if(!$(this).next().is(":visible"))
{
$(this).next().slideDown();
$(this).addClass('fa-chevron-up');
}
})
})
And in this case corresponds to an header tag (h3)
that in the text has another tag (<i>)
that needs to be changed... the problem here is that I'm not being able to get the I tag.
I've tryed $(this + ' i')
.... but no luck. This is the error logged to the console
Uncaught Error: Syntax error, unrecognized expression: [object HTMLHeadingElement] i
Upvotes: 0
Views: 43
Reputation: 3657
The i
tag is within each of the h3
's, correct? If so:
$('i', this)...
This makes use of context when making a Jquery selector.
Upvotes: 1
Reputation: 5048
I'm not entirely sure what you're trying to achieve. From what I understood, trying $(this).find("i")
may solve your problem.
Upvotes: 1