使用BootStrap模态框瞬间消失,且点击没有事件的Button按钮会刷新页面

布局时吧Button按钮放在了form表单中,导致进页面时,不做任何操作,首先点击三个Button按钮,会刷新页面,新增按钮本来有的 模态框 也不会弹出来会弹出并瞬间消失,以为是js冲突的原因,删除了BootStrap的js文件,还是同样的问题。

            <div class="col-md-8">
                <form class="form-inline">
                  <div class="form-group">
                    <label for="exampleInputName2">姓名&nbsp;&nbsp;&nbsp;&nbsp;</label>
                    <input type="text" class="form-control" id="exampleInputName2" placeholder="Jane Doe">
                  </div>
                  &nbsp;&nbsp;&nbsp;&nbsp;
                  <div class="form-group">
                    <label for="exampleInputEmail2">邮箱&nbsp;&nbsp;&nbsp;&nbsp;</label>
                    <input type="email" class="form-control" id="exampleInputEmail2" placeholder="jane.doe@example.com">
                  </div>
                  
                  <button class="btn btn-info"><span class="glyphicon glyphicon-search"></span>&nbsp;查询</button>
                  <button class="btn btn-primary" id="emp_add_modal_btn"><span class="glyphicon glyphicon-plus"></span>&nbsp;新增</button>
                  <button class="btn btn-danger" id="emp_delete_btn"><span class="glyphicon glyphicon-trash"></span>&nbsp;删除</button>
                </form>
            </div>

 

当把三个Button按钮移出form表单,就没有出现上面的问题了

<div class="row">
            <div class="col-md-8">
                <form class="form-inline">
                  <div class="form-group">
                    <label for="exampleInputName2">姓名&nbsp;&nbsp;&nbsp;&nbsp;</label>
                    <input type="text" class="form-control" id="exampleInputName2" placeholder="Jane Doe">
                  </div>
                  &nbsp;&nbsp;&nbsp;&nbsp;
                  <div class="form-group">
                    <label for="exampleInputEmail2">邮箱&nbsp;&nbsp;&nbsp;&nbsp;</label>
                    <input type="email" class="form-control" id="exampleInputEmail2" placeholder="jane.doe@example.com">
                  </div>
                </form>
            </div>
            <div class="col-md-4">
                <button class="btn btn-info"><span class="glyphicon glyphicon-search"></span>&nbsp;查询</button>
                <button class="btn btn-primary" id="emp_add_modal_btn"><span class="glyphicon glyphicon-plus"></span>&nbsp;新增</button>
                <button class="btn btn-danger" id="emp_delete_btn"><span class="glyphicon glyphicon-trash"></span>&nbsp;删除</button>
            </div>
        </div>

 

此篇只为记录自己开发路上的问题,望大神们多多指教。

posted on 2018-04-29 18:32  狮子与我  阅读(391)  评论(0编辑  收藏  举报

导航