Javascript 引导Popover在动态加载时不起作用
我有三个与该问题相关的文件,仅提供代码的基本部分:Javascript 引导Popover在动态加载时不起作用,javascript,php,html,jquery,popover,Javascript,Php,Html,Jquery,Popover,我有三个与该问题相关的文件,仅提供代码的基本部分: 每日事件页面.html文件: 其中的link变量指向我的php文件以查询sqldb 每日事件页面.php文件: if($eventResult->num\u rows>0){ $i=0; 而($inum_行){ $row=$eventResult->fetch_assoc(); $daily_event.=''。 $row[“事件名称”]。'; $daily_event.='.$row[“status”].'; $daily_event.=''
if($eventResult->num\u rows>0){
$i=0;
而($i<$eventResult->num_行){
$row=$eventResult->fetch_assoc();
$daily_event.=''。
$row[“事件名称”]。';
$daily_event.='.$row[“status”].';
$daily_event.=''.$row[“一周中的某一天]。';
$daily_event.='.$row[“一年中的一周]”;
$daily_event.='.$row[“event_year”]”;
$daily_event.='.$row[“开始时间”]。';
$daily_event.='.$row[“结束时间”]。';
$daily_event.='.$row[“machine_group]”;
$daily_event.='';
$i+=1;
}
}
该表加载了我从SQL DB需要的信息,但popover函数不起作用。
如何使popover显示在动态加载的表中,以便将鼠标悬停在一行上会显示带有消息“Some content”的popover?好的,它可能应该从读取该
数据内容
属性的值开始。您好@04FS,您是否介意详细说明读取部分?
<div class="container" id="main-container">
<div class="row">
<div class="col-1">
<button class="btn btn-primary" type="button">Back</button>
</div>
<div class="col-10" id="main-table">
<!--dynamic table to be inserted here-->
</div>
<div class="col-1">
<button class="btn btn-primary" type="button">Book Event</button>
</div>
</div>
</div>
$(document).ready(function(){
$('#main-table').load(link)
$('[data-toggle="popover"]').on("hover", function () {
$('[data-toggle="popover"]').popover({
title: "Actions for this Event",
placement: top
})
})
})
if ($eventResult->num_rows > 0) {
$i = 0;
while ($i < $eventResult->num_rows) {
$row = $eventResult->fetch_assoc();
$daily_event .= '<tr class="each-event" data-toggle="popover"
data-content="Some content"><td>' .
$row["event_name"] . '</td>';
$daily_event .= '<td>' . $row["status"] . '</td>';
$daily_event .= '<td>' . $row["day_of_week"] . '</td>';
$daily_event .= '<td>' . $row["week_of_year"] . '</td>';
$daily_event .= '<td>' . $row["event_year"] . '</td>';
$daily_event .= '<td>' . $row["start_time"] . '</td>';
$daily_event .= '<td>' . $row["end_time"] . '</td>';
$daily_event .= '<td>' . $row["machine_group"] . '</td>';
$daily_event .= '</tr>';
$i += 1;
}
}