1
I’m doing this job
<script>
function ver_endereco(){
$("tr.tr_end").toggle();
}
</script>
In this PHP code
<?php
while($row = $result->fetchArray()) {
?>
<tr class="tr_lista">
<td><?php echo $row['nome']; ?></td><td style="text-align: center;"><?php echo $row['forma_pagamento'];?></td>
<td><?php echo $row['observacao'];?></td><td style="text-align: center;"><?php echo $row['data_pedido'];?></td>
<td><input type="button" value="Ver mercadorias" onclick="ver_endereco();"/></td>
</tr>
<tr class="tr_end">
<td colspan="5">
<textarea rows="7" cols="90" disabled="disabled" style="resize:none;"><?php echo $row['mercadoria'];?></textarea>
</td>
</tr>
the problem is that the toogle effect is showing all the tr listed by while, and I want you to show only the tr that I am clicking with the "Ver_address" button. How could I ?
In
$("tr.tr_end").toggle()
Javascript will fetch all lines that have the classtr_end
, which are all apparently. To activate only the one you are pressing, you need to pass some unique identifier per function parameter.– Woss
this is the problem, I’m not able to pass the identifier that comes from php to the javascript function, because it seems that javascript does not accept strings with break lines, and the text that comes from the database that could identify the TR is coming with break lines
– user8465