问题
Trying to change on the go the title and content of a bootstrap Popover, I am having some trouble.
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.
Edited: I solved it thanks to the comments. I wasn't using the latest versions of Bootstrap. Once upgraded to 2.1.0, all seems to work perfect.
Important! In this new version, you need to set trigger to "hover" as it is by default to "click".
Thanks a lot
Pedro
回答1:
I solved it thanks to the comments. I wasn't using the latest versions of Bootstrap. Once upgraded to 2.1.0, all seems to work perfect.
来源:https://stackoverflow.com/questions/12130265/javascript-error-when-destroying-bootstrap-popover