bootstrap模态框一闪而过和两个模态框相互影响的问题

在使用Ajax获取数据传输到模态框到时候,数据传输过来了,模态框一闪而过,这个小问题卡了一下午,最后网上查好多文章,最后发现是一个特别容易忽略的小问题

错误代码:

<button  class="btn btn-primary btn-xs" data-toggle="modal"
data-target="#myModal" onclick="toUpdate(${c.id})">修改</button>

在button标签里添加type=“button”,问题解决

<button type="button" class="btn btn-primary btn-xs" data-toggle="modal"
data-target="#myModal" onclick="toUpdate(${c.id})">修改</button>

有时候同一个页面需要使用两个mota模态框,如果两个模态框相互影响,会出现输入不了和模态框混乱的问题,这钟情况我们只需要设置一个隐藏属性就能解决

<style type="text/css">
#newCustomerDialog,#customerEditDialog{display:none;}
</style>

猜你喜欢

转载自blog.csdn.net/Milan__Kundera/article/details/81781361