For example, I have the following text:
- Green Baseball Cap
- Cape Canaveral
I want to filter results with the string Cap. What I have right now is checking if the string contains a substring
but I want to match the actual word. This is what I have right now
$('#filter').click(function() {
...
// Filters items based on the search criterias.
$('figure.col-sm-3')
.has('tr:last-child>td:last-child:contains(' + month + ')')
.has('tr:last-child>td:last-child:contains(' + year + ')')
.has('h6:contains(' + brand + ')')
.has('h6:contains(' + type + ')')
.has("tr.price td:nth-child(even)")
.each(function(index, self) {
var price = $(self).find("tr.price td:nth-child(even)").eq(0).text();
arr.push(price);
totalPrice += parseFloat( price );
});
...
});