I have a table in which the loader value inside it through PHP needs to be in the value of some inputs that are in a modal window of the boostrap. I've tried several solutions, but it does not work. When I click on the table row, it loads the modal, but the field is empty. I intend to do so, using the table line to load the modal, and not a button to load the modal. follows the code: HTML Table
<tr data-toggle="modal" data-target="#modal_editar_veiculo">
<td id="teste"><?php echo $linha['PLACA'] ?></td>
<td><?php echo $linha['NOME'] ?></td>
<td><?php echo $linha['ANO'] ?></td>
<td><?php echo $linha['CPF'] ?></td>
</tr>
Modal window:
<!-- Modal editar cadastro veículo -->
<div class="modal fade bd-example-modal-lg" id="modal_editar_veiculo" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
<div class="modal-dialog modal-md" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="exampleModalLabel">Alterar dados do veículo</h5>
</div>
<div class="modal-body">
<form class="modal_novo_item">
<div class="row">
<div class="col-md-12">
<input type="text" placeholder="Nome" id="nome" name="nome">
</div>
</div>
<div class="row">
<div class="col-md-12">
<input type="text" placeholder="Ano" id="ano" name="ano">
</div>
</div>
<div class="row">
<div class="col-md-12">
<input type="text" placeholder="Placa" id="placa" name="placa">
</div>
</div>
<div class="row">
<div class="col-md-12">
<select name="proprietario">
<?php listar_editar( $link ); ?>
</select>
</div>
</div>
</form>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-dismiss="modal">Fechar janela</button>
<button type="button" class="btn btn-primary">Alterar</button>
<button type="button" class="btn btn-danger">Excluir</button>
</div>
</div>
</div>
</div>
The window opens, but does not work. In another project already done tinah, with another jQuery code, however, what carried the modal was a button. I tried to fit my code, but nothing. Thank you in advance.
Jquery that should be working:
<!--Open modal for editions -->
<script type="text/javascript">
$(document).ready(function (){
var valorDaDiv = $("#teste").text();
$("#placa").val(valorDaDiv);
};
</script>