0
Try to do it that way
$(function(){
$('#Tabela tbody tr').on('click',function(){
const id = $(this).attr('id');
const cod = $('#Tabela tbody tr[id='+id+'] td').eq(0).html(),
nome = $('#Tabela tbody tr[id='+id+'] td').eq(1).html();
$('#frm #cod').val( cod );$('#frm #nome').val( nome );
});
});
<html>
<head>
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" />
<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js"></script>
<style> tr{ cursor : hand; } </style>
</head>
<body>
<div class="container">
<form id="frm" name="frm" method="post">
<label for="cod">Cód</label><input type="text" id="cod" name="cod" />
<label for="cod">Nome</label><input type="text" id="nome" name="nome" />
</form>
<table id="Tabela" class="table table-sm table-hover table-light table-striped">
<thead>
<tr>
<td>Cód</td>
<td>Nome</td>
</tr>
</thead>
<tbody>
<tr id="1">
<td>01</td>
<td>Fulano de Tal 01</td>
</tr>
<tr id="2">
<td>02</td>
<td>Fulano de Tal 02</td>
</tr>
</tbody>
</table>
</div>
</body>
</html>
Thinking quickly, would you number the <tr id="<? php echo $num ? >" > and would take the id value via jquery and pass on the <td> information, there are other ways too but this is faster
– Wilson Rosa Gomes