gpt4 book ai didi

javascript - Bootstrap Modal确认不形成提交

转载 作者:行者123 更新时间:2023-12-03 03:00:19 25 4
gpt4 key购买 nike

我有一个表单,当我提交它时,我将显示或拦截一个模态框,确认包含确认文本的提交。当我点击确认时,提交不会完成,但会重新加载页面任何人都有想法。谢谢

$('#submit').click(function(){
alert('submitting');
$('#form').submit();
});
<form id="form" name="customer_file_update" method="post" action="XXXXXXX" class="form-horizontal">

{# place of fields#}

<button type="submit" id="customer_file_update_save_and_next" name="customer_file_update[save_and_next]" title="Valider le verdict et continuer" class="btn btn-success btn" data-toggle="modal" data-target="#confirm-verdict-modal" onclick="return false;">Valider le verdict et continuer</button>
<button .....>XXXX</button>
</form>



<div class="modal fade" id="confirm-verdict-modal" tabindex="-1" role="dialog" aria-labelledby="confirm-verdict-label" aria-hidden="true">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<div class="row">
<div class="col-md-11">
<h5 class="modal-title" id="confirm-verdict-label">XXXXXXXXXXXXXXX</h5>
</div>
<div class="col-md-1">
<button type="button" class="close" data-dismiss="confirm-verdict-label" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>
</div>
</div>
<div class="modal-body">
XXXXXXXXXXXXXxXXXXXXXXXXXX ?
<p class="text-danger">
/!\ XXXXXXXXXXXXXXXXXXXXXX!
</p>
</div>
<div class="modal-footer"
<a href="#" id="submit" class="btn btn-success success">Submit</a>
<button type="button" class="btn btn-secondary" data-dismiss="modal">Annuler</button>
</div>
</div>
</div>
</div>

最佳答案

$('#submit').on('click', function (e){
e=e || window.e;
e.preventDefault();
your_code_open_modal;
});

关于javascript - Bootstrap Modal确认不形成提交,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47431048/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com