我如何自动隐藏表单中的popover?我总是得到错误'对象不支持属性或方法' popover'''在这方面:
$(this).popover('hide');
$(("#" + $(this).attr("id")) + " .popover").popover('hide');
HTML:
<div class="label-panel" id="user-info">
<div class="login-label">@ViewBag.UserString</div>
<button type="button" class="information-icon" data-toggle="popover" data-content="And here's some amazing content. It's very engaging. Right?"> i</button>
</div>
和JQuery
$('[data-toggle="popover"]').popover();
$('#signup-form').on('click', function (e) {
$('[data-toggle="popover"]').each(function () {
//the 'is' for buttons that trigger popups
//the 'has' for icons within a button that triggers a popup
if (!$(this).is(e.target) && $(this).has(e.target).length === 0 && $('.popover').has(e.target).length === 0) {
$(this).popover('hide');
}
$(("#" + $(this).attr("id")) + " .popover").popover('hide');
});