Reputation: 4737
How could this code be better written? I mean I'm targeting a parent of a child of a parent. I don't know how to do it but it seems like there might be a more elegant way to do it.
$('.flex-overlay')
.children('.fluid-width-video-wrapper')
.parent('.flex-overlay')
.css({
'border': '1px solid red',
});
Upvotes: 2
Views: 64
Reputation: 144669
You can use has
method:
$('.flex-overlay')
.has('.fluid-width-video-wrapper')
.css({ 'border': '1px solid red'});
Upvotes: 5