Select a selectbox from a table click

Asked

Viewed 32 times

0

Hello I’m trying to pass the data from a table pulled from the database to the fields that belong to update in the same page where you register but I can only pass the data of the textbox the page is in php.

Down with the logic I was using.

$("#selUsuario").on('click', 'tr', function () {
var idUser = $(this).find(':nth-child(1)').text();
var nomeUser = $(this).find(':nth-child(2)').text();
var areaUser = $(this).find(':nth-child(3)').text();
var emailUser = $(this).find(':nth-child(4)').text();
var emiteUser = $(this).find(':nth-child(5)').text();
var origemUser = $(this).find(':nth-child(6)').text();
var masterUser = $(this).find(':nth-child(7)').text();


$(this).siblings().removeClass("marcada");
$(this).toggleClass("marcada");


$("#txtUsuario").val(idUser);
$("#txtNome").val(nomeUser);
    $("#sbSetor").val(areaUser);    
    $("#sbEmite").val (emiteUser);
    $("#sbOrigem").val (origemUser);
$("#sbMaster").val (masterUser);

});

  • I already know what you can do, but I don’t know what you can’t do. what you really want to do?

  • I wanted to fill a selectbox with the information I capture at the moment the line is clicked, the fields I cannot fill are the ones with "Sb" and the textbox works.

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.