gpt4 book ai didi

javascript - 允许单击一次 JavaScript 按钮

转载 作者:行者123 更新时间:2023-11-28 14:35:08 25 4
gpt4 key购买 nike

我的网站上有一些模态框。目前,当您单击“确认”时,它会发送多个确认信息。

重新发送部分邀请:

<div id="resendInvitePopup" class="popup-basic admin-form mfp-with-anim modalPopup">
<div class="panel">
<div class="panel-heading">
<span class="panel-title">
<i class="fa fa-check"></i>Confirm
</span>
</div>
@* end .panel-heading section *@

<div class="panel-body p25">
<div class="section row">
<div class="col-md-12 text-center">
<h3>Are you sure you want to <b class="text-success">re-send</b> this invite?</h3>
<p class="popupInfo fs12">An invite email will be sent to the user on confirmation</p>

<div class="summaryBox popupSummary formContainer">
@Html.Partial("_ResendInviteForm", Model)
</div>

</div>
@* end section *@
</div>
@* end section row section *@

</div>
@* end .form-body section *@

<div class="panel-footer">
<div class="text-center">
<input type="button" class="btn btn-primary CancelForm" value="Cancel" />
<input type="submit" class="btn btn-success SubmitForm" value="Send" />
</div>
</div>
@* end .form-footer section *@
</div>
@* end: .panel *@
<button title="Close (Esc)" type="button" class="mfp-close">×</button>

由于我的代码太大,我已链接到 Fiddle:https://dotnetfiddle.net/9tAmio

最佳答案

您可以使用 jQuery 函数 one以确保事件仅触发一次。

$('.ConfirmSubmit').one('click', function (e) {
// Submit form when the user confirms via the modal
$("#SubmitForm").trigger('click');

});

关于javascript - 允许单击一次 JavaScript 按钮,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50061139/

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