Try the method .filter.
var rows = $('tr').filter(function(){
var color = $(this).css("background-color");
return color === "#FF6600" || color === "rgb(255, 102, 0)" ;
});
I have not tested it, you may need to adjust the rgb part to account for distance.
Edit:
or better yet, it allows for uppercase and lowercase letters
var rows = $('tr').filter(function(){
var color = $(this).css("background-color").toLowerCase();
return color === "#ff6600" || color === "rgb(255, 102, 0)" ;
});
source
share