As the other guys said, or, if two conditions need to be applied separately, with a different code, for example, ...
var $tags = $("a[href*=tag]");
and then...
var $carTags = $tags.filter(":contains('cars')");
.filter() is a generic method for reducing existing jQuery selections.
Like many other jQuery methods .filter() returns a jQuery object, so it will be a chain:
var $foo = $("a[href*=tag]").filter(":contains('cars')").filter(".myClass");
.filter() also good for reasons that I was not going to explain, and I do not need, because @ bažmegakapa just did it very eloquently.
Beetroot-beetroot
source share