Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/371.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
Javascript 通过按钮调用时不显示模式_Javascript_Jquery_Twitter Bootstrap - Fatal编程技术网

Javascript 通过按钮调用时不显示模式

Javascript 通过按钮调用时不显示模式,javascript,jquery,twitter-bootstrap,Javascript,Jquery,Twitter Bootstrap,我有两个按钮来调用不同ID的单独模态。出于某种原因,只有一个按钮成功调用了其关联的模式“创建模式”,当单击另一个按钮时,似乎什么也没有发生,但如果单击“创建”按钮,则会同时显示“创建模式”和“删除模式”。下面是我的代码供参考 <div class="container"> <div class="row"> <button type="Submit" id="callcreate" class="btn btn-default btn-sm" style="

我有两个按钮来调用不同ID的单独模态。出于某种原因,只有一个按钮成功调用了其关联的模式“创建模式”,当单击另一个按钮时,似乎什么也没有发生,但如果单击“创建”按钮,则会同时显示“创建模式”和“删除模式”。下面是我的代码供参考

<div class="container">
 <div class="row">
   <button type="Submit" id="callcreate" class="btn btn-default btn-sm" style="margin-left: 10px; margin-right: 10px;" data-toggle="modal" data-target="#createModal">Create</button> 
   <button type="Submit" id="calldelete" class="btn btn-default btn-sm" style="margin-left: 10px; margin-right: 10px;" data-toggle="modal" data-target="#deleteModal">Delete</button>
 </div>

 <!-- Create Button to create a new profile -->
 <div class="modal fade" id="createModal" tabindex="-1" role="dialog" >
   <div class="modal-dialog">
      <div class="modal-content">
         <div class="modal-header">
            <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
            <h4 class="modal-title" id="createModalLabel">Create Profile</h4>
         </div>
         <div class="modal-body">
           <form method="" action="" name="requestprofiledata" id="requestprofiledata">
            <div >
              <label for="comment">Details: </label>       
              <table  id="tableID" class="table table-bordered table-hover tablewithtooltip">
                <thead>
                  //blah blah blah table/form stuff
              </table>
           </div>
          </form>
         </div>
         <div class="modal-footer">
            <button type="button" class="btn btn-default btn-default" data-dismiss="modal" name="newProfile" id="newProfile">Save</button>
         </div>
      </div><!-- /.modal-content -->
</div><!-- /.modal -->

<!-- Delete Profile button -->
<div class="modal" id="deleteModal" tabindex="-1" role="dialog" >
  <div class="modal-dialog modal-md">
    <div class="modal-content">         
      <div class="modal-header">
        <h4 class="modal-title" id="deleteModalLabel">Confirmation</h4>
      </div>
      <div class="modal-body" >
        <p>Do you wish to permanently delete this profile?</p>       
      </div>
      <div class="modal-footer">
       <button type="button" class="btn btn-default" data-dismiss="modal">Close</button> 
       <button type="button" class="btn btn-primary" name="deleteprofile" id="deleteprofile">Delete profile</button>
      </div>
    </div>
  </div>
</div><!-- /model -->

创造
删除
&时代;
创建配置文件
细节:
//诸如此类的桌子/表格之类的东西
拯救
确认书
是否要永久删除此配置文件?

接近 删除配置文件
您所有的
div
元素是否正确关闭

请留意:

     </div> <!------ THIS ADDED -->

在:


代码的问题在于#CreateModel中缺少一个


而且,如果你想让它淡入而不是弹出,那么你的deleteModel是缺少类淡入

<div class="modal fade" id="deleteModal" tabindex="-1" role="dialog" >


此外,这并不会真正影响性能,但您的表中缺少了一个结束标题标记

提交按钮提交。谢谢,我已将其更改为type=“button”,它仍然显示相同的行为。是的,它们是。我没有包括一个显示在按钮行下方的表格,因此忘记了在modals之前包含here。那么是还是否?你能确认我的演示是否如你所期望的那样有效吗?查看这个缩进版本:@PeterKA提供的示例按预期工作。第一个模态缺少一个
。当我从modals的官方引导文档中复制一些示例代码时,它们工作得非常好:。因此,结论是你的情态动词形式不正确。同意-彼得卡是正确的。您缺少两个结束标记。如果您添加了这些,并删除了表,那么您的示例代码就可以工作了。是的,谢谢!在创建模式结束时,我没有使用。非常感谢你!
<div class="modal fade" id="deleteModal" tabindex="-1" role="dialog" >