Cha*_*kar 1 html javascript jquery popover twitter-bootstrap-3
我在点击带有id的按钮时尝试提醒消息tagit.但整个表格出现在引导弹出窗口中.我还为警报消息添加了jquery,但它没有显示任何警告对话框,但是当我在javascript中调用相同的东西时它显示警报.但我需要它在jquery.我怎样才能做到这一点?
var htmlcont ='<table class="pop-table"><tr><td><button class="btn btn-warning" id="tagit">FILTER</button></td></tr></table>';
$('[data-toggle="popover"]').popover({content: htmlcont, html: true});
$("#tagit").click(function(){
alert("hello this is working");
});
Run Code Online (Sandbox Code Playgroud)
你需要使用event delegation,就像这样
$(document).on('click', "#tagit", function() {
console.log("hello this is working");
});
Run Code Online (Sandbox Code Playgroud)