【发布时间】:2016-07-08 09:56:13
【问题描述】:
似乎不会触发带有工具提示的动态创建元素:$(this).tooltip('show');
我做错了什么?
<div class="not-editable">
<span>Click here</span>
</div>
JS:
//dynamic tooltip
$('body').tooltip({
selector: '.not-editable .to-edit',
placement: 'bottom',
trigger: 'manual',
title: 'Actual times cannot be given as the trip is not confirmed',
template: '<div class="tooltip error-tooltip" role="tooltip"><div class="tooltip-arrow"></div><div class="tooltip-inner"></div></div>'
});
//dynamic added element...
setTimeout(function(){
$('.not-editable').find('span').addClass('to-edit');
}, 1000);
//Trying to trigger the tooltip
$(document).on('click', '.to-edit', function(){
console.log("showing...");
$(this).tooltip('show');
});
【问题讨论】:
标签: javascript css twitter-bootstrap twitter-bootstrap-3