因此,所选择的插件仅在单击按钮后添加html。这就是为什么我的代码不工作。对于将来有类似问题的任何人,这是应该做的:
$(document).ready(function () {
$(".chosen-select").chosen();
$(".chosen-container").click(addtitles);
// We need to execute the Jquery every time the button gets clicked.
});
则在函数中:
function addtitles(){
var i = 0;
$(".active-result").each(function () {
$(this).attr("data-toggle","tooltip");
$(this).attr("title",serializedResult[i]);
$(this).attr("data-placement","right");
$(this).parent().css("overflow","visible")
$(this).tooltip();
i++;
});
}