JSFiddle - React, Tailwind, and code Playground
HTML
<table>
<tr>
<td>t1</td>
<td>t2</td>
<td>t3</td>
</tr>
</table>
JavaScript
var question = "{title_2}";
$('td').click(function(){
question = question.replace(/{title_(\d+)}/g, $.proxy(function(x, m){
return $(this).closest('tr').find('td:eq('+(m-1)+')').html();
}, this));
alert(question);
});