需要在模态中删除按钮删除该模态及其按钮

时间:2015-07-27 17:57:18

标签: javascript twitter-bootstrap button modal-dialog

所以在bootstrap中你不能在模态中有一个模态。我完全理解这一点。我有一个从按钮弹出的模态。我需要在该模态中删除按钮,删除模态按钮。有帮助吗?有任何想法吗?谢谢。

如果需要,这是一个简单的模态小提琴:JSFiddle

<button class="btn btn-primary btn-lg" data-toggle="modal" data-target="#myModalHorizontal">Modal</button>
<!-- Modal -->
<div class="modal fade" id="myModalHorizontal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-dialog">
    <div class="modal-content">
        <!-- Modal Header -->
        <div class="modal-header">
            <button type="button" class="close" data-dismiss="modal"> <span aria-hidden="true">&times;</span>
 <span class="sr-only">Close</span>

            </button>
             <h4 class="modal-title" id="myModalLabel">
                Modal title
            </h4>

        </div>
        <!-- Modal Body -->
        <div class="modal-body">
            <form class="form-horizontal" role="form">
                <div class="form-group">
                    <label class="col-sm-2 control-label" for="inputEmail3">Email</label>
                    <div class="col-sm-10">
                        <input type="email" class="form-control" id="inputEmail3" placeholder="Email" />
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-sm-2 control-label" for="inputPassword3">Password</label>
                    <div class="col-sm-10">
                        <input type="password" class="form-control" id="inputPassword3" placeholder="Password" />
                    </div>
                </div>
                <div class="form-group">
                    <div class="col-sm-offset-2 col-sm-10">
                        <div class="checkbox">
                            <label>
                                <input type="checkbox" />Remember me</label>
                        </div>
                    </div>
                </div>
                <div class="form-group">
                    <div class="col-sm-offset-2 col-sm-10">
                        <button type="submit" class="btn btn-default">Sign in</button>
                    </div>
                </div>
            </form>
        </div>
        <!-- Modal Footer -->
        <div class="modal-footer">
 <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
        <button type="button" class="btn btn-primary">Save changes</button>
        </div>
    </div>
</div>

1 个答案:

答案 0 :(得分:0)

尝试将ID添加到要删除的模式和删除按钮。 在这个例子中,我使用jquery删除按钮。

$('#delete-button').click(function() { $('#delete_this').remove(); });

Updated jsfiddle