I have this html and want to select only the div with class 'image-container landscape'.
<div class="image-container landscape"> ... </div> ... <div class="image-container portrait"> ... </div>
Using $(element).find('.image-container') selects either one of the div, that comes first. But I only want the one with 'landscape'. I tried using $(element).find('.image-container landscape') but it doesn't work, maybe because it assumes landscape is a tag. How do I do this?
$(element).find('.image-container')
$(element).find('.image-container landscape')
landscape
Yes, it would assume landscape was a tag. You want either:
[class="image-container landscape"]
or
.image-container.landscape
This is just CSS3 for the record, you can probably read the full specs in less than an hour.
1.4m articles
1.4m replys
5 comments
57.0k users