首先,问题的小提琴:jsfiddle.net引导酥料饼,。点击里面没有赶上酥料饼的按钮
我使用的是酥料饼,它的内容是HTML,带班“click_me”的按钮。我有jquery听点击“click_me”,它应该会发出警报。但是,它没有。我错过了什么吗?
JS:
jQuery(document).ready(function($) {
$('.demo_button').click(function() {
$(this).popover({
html: true,
trigger: 'manual',
placement: 'right',
content: function() {
var $buttons = $('#popover_template').html();
return $buttons;
}
}).popover('toggle');
});
$('.click_me').click(function() {
alert('it works!');
});
});
HTML:
<button class="btn btn-primary demo_button">Click here</button>
<div id="popover_template">
<button class="btn click_me">Make Alert</button>
</div>
我并没有考虑它不是在加载时创建的。谢谢,这是一个完美的答案! –