Reputation: 2291
I need to break an event that i submitted and when it breaks a popup will come, after I click the button I understood then it will continue to the rest of the code to execute it.
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');
});
});
Upvotes: 0
Views: 119
Reputation: 410
Move you alert script
$(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');
});
});
});
Upvotes: 2