JSFiddle - React, Tailwind, and code Playground
HTML
<table class="table table-bordered table-stripped">
<tr>
<th>Name</th>
<th>Address</th>
<th>Action</th>
</tr>
<tr>
<td class="name">Name1</td>
<td class="address">Address1</td>
<td class="edit"><a href="javascript:void(0);">Edit</a>
<input hidden type="radio" name="select">
</td>
<tr>
<tr>
<td class="name">Name2</td>
<td class="address">Address2</td>
<td class="edit"><a href="javascript:void(0);">Edit</a>
<input hidden type="radio" name="select"></td>
<tr>
</table>
<!-- Modal -->
<div class="modal fade" id="checkInModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
<h4 class="modal-title" id="myModalLabel">Check In</h4>
</div>
<div class="modal-body">
<div class="row">
<div class="col-md-12">
<label>Name:</label>
<input type="text" class="form-control" id="editName">
</div>
<div class="col-md-12">
<label>Address:</label>
<input type="text" class="form-control" id="editAddress">
</div>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
<button type="button" class="btn btn-primary btn-save">Save changes</button>
</div>
</div>
</div>
</div>
JavaScript
$(document).ready(function(){
$('.edit').click(function(){
var that = this;
$(this).find(':radio').prop("checked",true);
loadData(that);
$('#checkInModal').modal({
});
});
function loadData(that){
$('#editName').val($(that).parent().find('.name').html());
$('#editAddress').val($(that).parent().find('.address').html());
}
$('.btn-save').click(function(){
// Update the new values inside the Table
var row = $('input[name=select]:checked').parent().parent();
$(row).find('.name').html( $('#editName').val());
$(row).find('.address').html( $('#editAddress').val());
$('#checkInModal').modal('hide');
//Create an object with the saved values and post it to server
});
});