The problem is the following php returns me several buttons with a hidden input to identify the button.
$nome = $mysqli->query("SELECT * FROM menbros ORDER BY id");
while ($row = $nome->fetch_assoc()) {
$nome = $row['identifier'];
$i = $row['id'];
<input type='hidden' value='".$i."' id='troca'/>
<button type='button' onclick='troca()'>
}
I need the javascript variable to get the value of the input of the button that was clicked.
This form down returns the first input of the page but as I have several I need my variable to get the value of the input above the button clicked. var exchange = $ ("# exchange"). val ();