在“> </div>”中清空“<div class =”模态背景淡入淡出

时间:2016-01-22 12:44:55

标签: javascript twitter-bootstrap-3 modal-dialog bootstrap-modal

我的代码中有模态的问题,没有出现和类“模态背景淡入”的div是空的。

<body>
<button type="button" title="Usuń" class="deleteButton btn btn-default btn-xs pull-right">Usuń</button>

<div id="confirm" class="modal hide fade">
<div class="modal-body">
    Are you sure?
</div>
<div class="modal-footer">
    <button type="button" data-dismiss="modal" class="btn btn-primary" id="delete">Delete</button>
    <button type="button" data-dismiss="modal" class="btn">Cancel</button>
</div>

  

$("body").on('click', "button.deleteButton", function (e) {
  var clickedButton = $(this);
  e.preventDefault();
  $('#confirm').modal({ backdrop: 'static', keyboard: false })
    .one('click', '#delete', function () {
    clickedButton.attr("disabled", true);    
  });
});

这是我的小提琴: https://jsfiddle.net/cjdtzsha/

它可能是什么原因?

1 个答案:

答案 0 :(得分:2)

hide <div id="confirm" class="modal hide fade"> importantdisplay:none属性<div class="modal-content"></div>规则中删除modal-header课程,不要让模式显示。

Remove Hide Selector

现在添加modal-footer并将<div id="confirm" class="modal fade"> <div class="modal-content"> <div class="modal-body"> Are you sure? </div> <div class="modal-footer"> <button type="button" data-dismiss="modal" class="btn btn-primary" id="delete">Delete</button> <button type="button" data-dismiss="modal" class="btn">Cancel</button> </div> </div> </div> In [18]: df1.add(df).fillna(df1) Out[18]: a b c d 0 2 4 8 9 1 2 12 10 7 2 2 16 14 10 括在其中

Add modal-content

In [20]:
df1.add(df).combine_first(df1)

Out[20]:
   a   b   c   d
0  2   4   8   9
1  2  12  10   7
2  2  16  14  10

解决所有问题。