Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/75.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
在Bootstrap中处理javascript_Javascript_Html_Css - Fatal编程技术网

在Bootstrap中处理javascript

在Bootstrap中处理javascript,javascript,html,css,Javascript,Html,Css,我正在尝试使“popover”为引导工作。我相信我的代码是正确的,但我不确定javascript部分是否正确。下面是我头脑中包含的内容—导入javascripts—以及我的标记的外观。谢谢你的帮助 <script src="http://code.jquery.com/jquery-latest.js"></script> <script src="js/bootstrap.js" type="text/javascript"></script&g

我正在尝试使“popover”为引导工作。我相信我的代码是正确的,但我不确定javascript部分是否正确。下面是我头脑中包含的内容—导入javascripts—以及我的标记的外观。谢谢你的帮助

  <script src="http://code.jquery.com/jquery-latest.js"></script>
 <script src="js/bootstrap.js" type="text/javascript"></script> 
<script src="js/JSForFinal.js" type="text/javascript"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
我的身体标签中的标签如下所示:

      <a href="#" rel="popover" data-placement="right" data-original-title="popover on     
      right">Stuff</a>


我觉得一切都是正确的,但当我点击按钮时,什么也没有弹出。谢谢大家!

在jquery文档准备咒语中包装您的js:

$(function() {
     $("a[rel=popover]").popover('show');
});
这是以下的简写:

$(document).ready(function() {
     $("a[rel=popover]").popover('show');
});
它告诉jquery推迟执行,直到文档准备就绪

如果要将执行延迟到单击按钮或其他操作,则:

$(function() {
     $('#buttonid').click(function() {
         $("a[rel=popover]").popover('show');
     });
});

首先,您要加载jQuery的多个副本。别那么做,你什么意思?第一个剧本怎么样?我不想包括它,但我认为它会解决我的问题将第四项移到第一项,并删除第一项,然后尝试一些工作Arun,问题解决谢谢你这样做有效,但你能解释为什么它有效吗?我宁愿知道为什么,然后就用它。非常感谢。如何阻止它最初显示,仅在按下时激活?使用引导
.popover
,您无需将其包装在单击功能中。不要使用
.popover('show')
,只需使用
.popover()
,它将向引导注册元素,然后引导将处理显示和隐藏本身。
$(function() {
     $('#buttonid').click(function() {
         $("a[rel=popover]").popover('show');
     });
});