Solved it myself. Apparently .popover('destroy')
is asynchronous, and immediate creation of another popover fails, while the previous one is being destroyed. I tried adding delay by using alert
, which failed for some reason. Using setTimeout()
before creating new popover is not the most elegant, but working solution:
$('#popoverspan').popover('destroy');
setTimeout(function () {
$('#popoverspan').popover({
placement : 'bottom',
trigger : 'hover',
content : 'Here is new popover!'
});
}, 200);
200 ms seems enough, but it may need finetuning in other cases.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…