JSFiddle - React, Tailwind, and code Playground

by Fredrik Berggren

HTML

<script src="https://code.jquery.com/jquery-2.2.0.js"></script>
<table id="table_clients">
<thead>
  <tr><th>ID</th>
  <th>Clients name</th>
  </tr>
</thead>
<tbody>
  <tr>
  <td>1</td>
  <td>Client 1</td>
  </tr>
  <tr>
  <td>1</td>
  <td>Client 1</td>
  </tr>
</tbody>
</table>

JavaScript

$('#table_clients tbody').on('click', 'tr', function(e) {
	var id = $(e.currentTarget).children().first()[0].innerText;
  //for debugging
  console.log(id);
  
   $("#container_info").replaceWith(
      '<%= j render :partial  => "client_info", :locals =>  {:client => '+id+'} %>'
   );
});