简体   繁体   English

销毁Bootstrap popover时出现Javascript错误

[英]Javascript error when destroying Bootstrap popover

Trying to change on the go the title and content of a bootstrap Popover, I am having some trouble. 试图改变一个引导Popover的标题和内容,我遇到了一些麻烦。

I am getting this issue when destroying a popover content in a selector. 我在销毁选择器中的弹出窗口内容时遇到此问题。

The error is this 错误就是这个

TypeError: 'undefined' is not a function (evaluating 'data[option]()')

The piece of code is this: 这段代码是这样的:

$("#test_name-" + json.test_id).popover('destroy');

I get the error in that line. 我收到了该行的错误。 I have checked that $("#test_name-" + json.test_id) really contains a Popover. 我已经检查过$("#test_name-" + json.test_id)真的包含一个Popover。

Edited: I solved it thanks to the comments. 编辑:由于评论我解决了。 I wasn't using the latest versions of Bootstrap. 我没有使用最新版本的Bootstrap。 Once upgraded to 2.1.0, all seems to work perfect. 一旦升级到2.1.0,一切似乎都很完美。

Important! 重要! In this new version, you need to set trigger to "hover" as it is by default to "click". 在这个新版本中,您需要将触发器设置为“悬停”,因为它默认为“单击”。

Thanks a lot 非常感谢

Pedro 佩德罗

I solved it thanks to the comments. 由于评论,我解决了它。 I wasn't using the latest versions of Bootstrap. 我没有使用最新版本的Bootstrap。 Once upgraded to 2.1.0, all seems to work perfect. 一旦升级到2.1.0,一切似乎都很完美。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM