JSFiddle - React, Tailwind, and code Playground
by richbuff
HTML
<div class='name'>rich buff</div>
<div class='name'>buff</div>
<div class='name'>rbuff</div>
<div id='answer'>foo</div>
JavaScript
$.extend($.expr[":"], {
"startswith": function(elem, i, data, set) {
var txt = $.trim($(elem).text());
var term = data[3];
return txt.indexOf(term) === 0;
}
});
$('#answer').html($("div:startswith('rich')").html());