Twitter Bootstrap Popover error

巧了我就是萌 提交于 2020-01-06 07:59:00

问题


I am facing some error with twitter bootstrap popover example

HTML

 <h1>Popover</h1>
 <a href="#" id="example" class="btn btn-primary" rel="popover"
    data-content="This isthe body of Popover"
    data-original-title="Creativity Tuts">
 </a>

Included Script Tags

src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"
src="js/bootstrap.js"
src="js/Tooltip.js"
src="js/Popover.js"

My JavaScript

$(function() {
    $('example').popover();
});

I downloaded the following libraries:

  • bootstrap.js
  • bootstrap.min.js
  • popover.js
  • tooltip.js

But the code still does not work


回答1:


example is the id or the target element, so you need to use id selector(prefix #). Your selector(element selector) looks for an element with tag name example like <example ...>...</example>

$('#example').popover();


来源:https://stackoverflow.com/questions/19498770/twitter-bootstrap-popover-error

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!