I have 2 tables, each row of tables has a checkbox
<table class="One">
<thead>
<tr>
<th>choose</th>
<th>Code 1</th>
</tr>
</thead>
<tbody>
<tr>
<th scope="row"><input type="checkbox" class="form-check-input"></th>
<td>123</td>
</tr>
<table class="Two">
<thead>
<tr>
<th>choose</th>
<th>Code 2</th>
</tr>
</thead>
<tbody>
<tr>
<th scope="row"><input type="checkbox" class="form-check-input"></th>
<td>456789</td>
</tr>
Within the modal has a form
<button type="button" class="btn btn-primary" data-toggle="modal" data-target="#formModal">
Continue
</button>
<div class="modal fade" id="formModal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="exampleModalLabel">Modal Form</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
</div>
<div class="modal-body">
<form action="" method="post">
/* inputs here */
<button type="submit" class="btn btn-primary">Submit</button>
</form>
</div>
</div>
</div>
</div>
I would like to capture just one checkbox from each of these tables and transform into input within the modal when I click continue button modal. How do I do this with jquery?
EDIT
https://jsfiddle.net/43zy6mt9/
I can pass the values to the variable jquery. How do I get this value and create an input in modal with it?