Wesley Howard
Wesley Howard

Reputation: 65

Having a small issue adding CSS to some JS

I'm trying to convert the following CSS

img.rsImg.rsMainSlideImage {
    display: inline-block;
}

Into Javascript

$('img').closest('.rsImg').closest('.rsMainSlideImage').css('display', 'inline-block');

And something I'm doing seems to be a bit off. I used the same script with a single div and it worked, but this is a bit nested.

Upvotes: 0

Views: 52

Answers (1)

Jonas Wilms
Jonas Wilms

Reputation: 138257

What about

$("img.rsImg.rsMainSlideImage").css("display", "inline-block");

Upvotes: 4

Related Questions