更改输入文本以提交按钮

时间:2016-11-06 22:06:25

标签: javascript jquery ajax twitter-bootstrap bootstrap-modal

我确信这很简单。我有一个提交表单,其中包含删除确认模式。如果确认将发布数据。出于设计目的,我希望打开模态的文本输入更改为按钮。它可以作为文本输入,但不是按钮。

<form name="checkbox" id="checkbox" method="POST" action="index.php">
<input type="hidden" name="value" value="20">

目前提交按钮:

 <input type="text" name="deleteall" value="yes" id="deleteall" data-toggle="modal" data-target="#confirm-submit"/>

希望它改为此,但模态不会出现

<button type="submit" value="yes" name="deleteall" id="deleteall" data-toggle="modal" data-target="#confirm-submit"><span class="fa fa-trash"></span> Delete</button>

模态:

<div class="modal fade" id="confirm-submit" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header">
                Confirm Submit
            </div>
            <div class="modal-body">
                Are you sure you want to delete all selected?
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button>
                 <button type="submit" id="submit" name="deleteall" value="yes" class="btn btn-danger" data-dismiss="modal">Delete</button>
            </div>
        </div>
    </div>
</div>

使用Javascript:

$('#submit').click(function(){
    $('#checkbox').submit();
});

0 个答案:

没有答案