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.
closest()method seeks outward. Why aren't you simply putting your selector in the initial argument?.rsMainSlideImagewith a child.rsImgwith a childimg. :))rsMainSlideImageandrsImg.closest()searches up the DOM.