This will make it so that whenever you click on a td
, it will highlight all the td
s with the same text yellow.
$("td").click(function() {
var value = $(this).text();
$("td")
.css("background-color", "")
.filter(function(){
return $(this).text() === value;
})
.css("background-color", "yellow");
});
You can see this in action on jsFiddle.