Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/85.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
Html Bootstrap 3模式不适用于按钮单击_Html_Twitter Bootstrap - Fatal编程技术网

Html Bootstrap 3模式不适用于按钮单击

Html Bootstrap 3模式不适用于按钮单击,html,twitter-bootstrap,Html,Twitter Bootstrap,我根据教程制作了一个简单的模态,当我单击按钮时,模态不会显示。我尝试将href更改为数据目标,但这并不能解决问题。下面的代码是模态代码。我的CSS或JavaScript文件中没有任何内容 <a data-target="#myModal" role="button" class="btn btn-warning" data-toggle="modal"><span class="glyphicon glyphicon-hand-up"></span>Sign

我根据教程制作了一个简单的模态,当我单击按钮时,模态不会显示。我尝试将
href
更改为
数据目标
,但这并不能解决问题。下面的代码是模态代码。我的CSS或JavaScript文件中没有任何内容

<a data-target="#myModal" role="button" class="btn btn-warning" data-toggle="modal"><span class="glyphicon glyphicon-hand-up"></span>Sign up for weekly newsletter</a>

<div class="modal fade" id="myModal">
              <div class="modal-dialog">
                <div class="modal-content">
                  <div class="modal-header">
                    <button class="close" data-dismiss="modal">&times;</button>
                    <h4 class="modal-title">Sign up for the newsletter</h4>
                    <div class=modal-body>

                    </div>
                  </div>
                </div>
              </div>
            </div>

尝试将模式html放在html的根目录中,可能紧跟在body标记之后。它可以放在所有html的底部,但作为正文的直接嵌套元素或之后的一个div

模态html可用于以下内容的即时嵌套:

  • 正文>div>模式html
  • 正文>模态html
那就行了。否则,如果模态html被放置在许多嵌套元素中,那么它就不起作用


谢谢。

在你的头脑中,你需要有以下几点。同时移除身体底部的引导链接。在我看来,您可能正在运行过时版本的bootstrap js

<link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
<script src="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script>


以下是一个示例。

我们可以看到您的按钮代码吗?@CharlieFish我添加了它。您是包含引导JS还是仅包含CSS?我忘了这对情态动词是否有影响。我知道它对某些事情有用。我想你需要它来做情态转换。是的,我有引导JS。你能试着把a标签改成按钮标签吗?它确实需要是数据目标,但我认为数据目标只适用于按钮。