CSS:
<div class="views-row views-row-10 views-row-even views-row-last">
<div class="sonuc">
<span>text1</span>
</div>
</div>
<div class="views-row views-row-11 views-row-even views-row-last">
<div class="sonuc">
<span>text2</span>
</div>
JavaScript:
if ($(".sonuc").has(":contains('text1')").length) {
$('.sonuc:contains("text1")').parent().addClass('hobi')
}
The code works, but it adds the hobi
class to all parent divs. I want to add it only to the parent div of text1. How can I fix this?