JSFiddle - React, Tailwind, and code Playground

by ChrisStanyon

HTML

<table id="ResultsTableTxt">
  <tr data-ref="m1"><td>Delivery included to postcode: <span></span></td></tr>
  <tr data-ref="m2"><td>You have selected: <span></span> for your answer in M2</td></tr>
  <tr data-ref="m3"><td>Row 3 <span></span></td></tr>
  <tr data-ref="m4"><td>Row 4 <span></span></td></tr>
  <tr data-ref="m5"><td>Row 5 <span></span></td></tr>
</table>

<button id="show">Show Row 1 with Postcode</button>

CSS

#ResultsTableTxt tr { display:none; }
#ResultsTableTxt tr.show { display:table-row; }

JavaScript

$('#show').click(function() {
  var messId = "m1";
  var newText = "AB1 1BA"
  var row = $('#ResultsTableTxt tr').filter( function() { return $(this).data('ref') == messId } );

  $('span', row).text( newText );
  row.addClass('show');
});