3
I have several records in PHP, and when clicking one link "More information" opens a <div>
hidden, but when clicking on this link opens the <div>
hidden from all records.
My Javascript code is as follows::
function abreFecha(sel) {
$(sel).slideToggle();
}
css:
.mapa{
display:none;
}
link:
<div class="maisinfo"><a href="javascript:abreFecha('.mapa')">+</a></div>
div:
<div class="mapa"> <?php echo $row_RS_busca['mapa']; ?> </div>
And another detail, all this is within a PHP’s. Ie is showing all the records.
As requested! I am posting the html structure
<?php do { ?>
<div class="caixa">
<div class="maisinfo"><a href="javascript:abreFecha('.mapa')">+</a></div>
<table width="510" height="72" border="0" cellpadding="0" cellspacing="4">
<tr>
<td width="15" rowspan="3" align="left" valign="top"><p> </p></td>
<td height="31" colspan="2"><span class="style5"><?php echo $row_RS_busca['nome']; ?></span></td>
</tr>
<tr>
<td width="29" height="16" align="left" class="style3"><img src="imagens/tel.png" width="10" height="15" /></td>
<td width="450" align="left" valign="bottom" class="style6"><?php echo $row_RS_busca['telefone']; ?></td>
</tr>
<tr>
<td height="17" align="left" class="style3"><img src="imagens/local.png" width="10" height="17" /></td>
<td align="left" valign="top" class="style6"><?php echo $row_RS_busca['endereco']; ?></td>
</tr>
</table>
</div>
<br/>
<div class="mapa"> <?php echo $row_RS_busca['mapa']; ?> </div>
<?php } while ($row_RS_busca = mysql_fetch_assoc($RS_busca)); ?>
What is the structure of HTML? instead of this selector which is generic
.mapa
you could pass an element, or another more specific selector... if you put the HTML structure it is easy to solve.– Sergio
Open all records because the class selector returns a list, you have to grab the Parent from the clicked button or something more specific.
– Luis Henrique
Instead of passing . map, pass something like #Mapa1. When passing . map ALL HTML elements with class . map will open.
– PauloHDSousa
Thanks for adding HTML! So what you need is to open div
.mapa
that’s following the div.caixa
where you click on the link inside.maisinfo
, correct?– Sergio
Yes yes, I need this. But when I click open all
– Gustavo Cardoso