I'm doing a little project and got a small problem. I'm printing out a table from MySQL database data.
One of the fields is image. I print it out and I want it to pop up when clicked but all I can do is execute the script only once, meaning only the first picture on the page will pop up when clicked.
<div id="contentRight">
.......
<tr>
<td align="center" valign="top">
<?php do { ?>
<table width="630" border="1" class="TableStyle">
<tr>
........
<script>
$(document).ready(function() {
$('#img').on('click','.btn', function () {
var image = '<img src="<?php echo $row_ManageUsers['preview_thumb']; ?>">';
$('#popover').popover({placement: 'bottom', content: image, html: true});
});
});
</script>
<td width="100" height="100" rowspan="3" id="img"><a id="popover" class="btn" rel="popover" data-content="" title="Preview" >
<img src="<?php echo $row_ManageUsers['preview_thumb']; ?>" width="130px" height="130px" class="img-thumbnail" $nbsp;></a>
</td>
</tr>
.......
<?php } while ($row_ManageUsers = mysql_fetch_assoc($ManageUsers)); ?>
.......
The script is copied and it gets a proper value every time but it will not execute.
Any advice?