我需要打破我提交的事件,当它突然出现弹出窗口时,点击我理解的按钮后,它将继续执行其余的代码。
Jquery的
$(document).ready(function() {
$("#search_cerf").submit(function(e){
e.preventDefault();
$('.site-content-area').html('Some Stuff done');
// Popup comes up and we stop here
$('.container .site-content-area').append('<div class="popup-thank-you" style="display: block;"><h2>ERROR</h2><span class="message-popup">THE BIG MESSAGE</span><br><br><br><button id="gotit" class="gotitval">I understand. Please validate now</button></div>');
// after users click I understood please validate now it shoul continue to next step
$('.container').on('click', '.gotitval', function(event) {
$('.popup-thank-you').remove();
});
// do some other stuff ajax related
alert ('script had finished');
});
});
答案 0 :(得分:2)
移动警报脚本
$(document).ready(function() {
$("#search_cerf").submit(function(e){
e.preventDefault();
$('.site-content-area').html('Some Stuff done');
// Popup comes up and we stop here
$('.container .site-content-area').append('<div class="popup-thank-you" style="display: block;"><h2>ERROR</h2><span class="message-popup">THE BIG MESSAGE</span><br><br><br><button id="gotit" class="gotitval">I understand. Please validate now</button></div>');
// after users click I understood please validate now it shoul continue to next step
$('.container').on('click', '.gotitval', function(event) {
$('.popup-thank-you').remove();
alert ('script had finished');
});
});
});