Código PHP:
Ver original<?php while($row1 = $query->fetch_array()){ $con=1; ?>
<div class="show" id="<?php echo $con; ?>">
<img src="images/<?php echo $row1["name"]; ?>.png" alt="<?php echo $row1["name"]; ?>" title="<?php echo $row1["name"]; ?>" width="50" height="50"><br>
<div>
<span class="nameBox">
<?php echo $row1["name"]; ?></span>
</div>
</div>
//The dialog which will appear after clicking on the image
<dialog class="myDialog" id="<?php echo $con; ?>">
<span id="<?php echo $con; ?>" class="close">x</span>
<h3 class="headerDialog"><?php echo $row1["name"]; ?></h3>
<p style="background: black; color: white">phone: <?php echo $row["phone"]; ?><br>
address: <?php echo $row["address"]; ?></p>
</dialog>
<?php $con++; } ?>
Código Javascript
:
Ver original$(".show").click(function(){
var id = $(this).attr('id');
$("#"+id).showModal();
})
$(".close").click(function(){
var id = $(this).attr('id');
$("#"+id).close();
})
prueba asi a ver