我花了一整天的时间试图在表中设置一些popover,以显示每个单元格的更多信息。但我得出的结论是,popover在我的代码中根本不起作用。如何以及为什么?有人知道它可能是什么吗?
<td>
<div>
<span class="btn" id="infoItem" data-toggle="popover" rel="popover">
<?php echo $row[0] ?>
</span>
<script>
$(document).ready(function() {
$('[data-toggle="infoItem"]').popover({
html: true,
animation: false,
content: <?php echo $row[0] ?>,
placement: "bottom"
});
});
</script>
</div>
</td>
现在,我只是在弹出窗口中显示与在单元格中相同的信息。信息显示在单元格中,因此popover不是空的。
这是正在工作的JS Fiddle
$(document).ready(function() {
$('[data-toggle="popover"]').popover({
html: true,
animation: false,
content: 'World',
placement: "bottom"
});
});
i realized you are missing some quotes '' and a semi colon on your script
<td>
<div>
<span class="btn" id="infoItem" data-toggle="popover" rel="popover">
<?php echo $row[0]; ?>
</span>
<script>
$(document).ready(function() {
$('[data-toggle="infoItem"]').popover({
html: true,
animation: false,
content: '<?php echo $row[0]; ?>',
placement: "bottom"
});
});
</script>
</div>
</td>