JSFiddle - React, Tailwind, and code Playground

by abubelinha

HTML

<script src="https://code.jquery.com/jquery-3.0.0.min.js"></script>
<script src="https://code.jquery.com/ui/1.11.4/jquery-ui.min.js"></script>
    <span class="parent" id="1">
    	<p>..</p><p>..</p>
    	<span>text</span>
    	<a>..</a>
    </span>
    <span class="parent" id="2">
    	<span>some text</span>
    	<a>..</a>
    </span>
    ....
    <span class="parent" id="n">
    	<p>..</p>
    	<span>other</span>
    </span>

JavaScript

var current = "text";
var test = $('.parent').children().filter(function() {
  return $(this).text() === current;
}).parent();

test.css('color', 'red');