MeltingDog MeltingDog - 1 month ago 3x
jQuery Question

Is there a better way to select multiple elements that have the same parent elements?

Is there a way I can simplify this selector, seeing as the parent elements are the same?

$(".card .card-title .fa-star-o, .card .card-title .fa-star")

eg something like:

$(".card .card-title (.fa-star-o, .fa-star)")

(above doesnt work, obviously)

The comma way does work of course, but I'm just wanting to know if there's a better, cleaner way.


Here it's

$(".card .card-title").find(".fa-star-o, .fa-star")
                      .css({"color": "red", "border": "2px solid red"});