JSFiddle - React, Tailwind, and code Playground

HTML

<table class="fruits" border="1">
<tr>
    <td>Apple</td>
    <td>$2.50</td>
    <td>Buy Apple</td>
</tr>
<tr>
    <td>Pineapple</td>
    <td>$2.50</td>
    <td>Buy Pineapple</td>
</tr>
</table>

JavaScript

$("table").find("tr").each(function(){

$(this).find("td").each(function(){
  
    var txt=$(this).html();
    var question=txt;
    var pattern="/{"+txt+"}/g";
    question = question.replace(pattern, txt);
    alert(question);
});
});