$("form#generate_vouchers").submit(function(e){
if($("input#quantity").val() > 100){
e.preventDefault(); // stop submit
var warning = "It will take around " + Math.round(($("input#quantity").val() / 23)) + " seconds to generate this batch.<br />Generation will continue even if you leave this page.";
//Does around 23 codes per second, nearly all of that time is inserts.
$('<div title="Batch information"></div>').html(warning).dialog({
draggable: false,
modal: true,
minWidth: 350,
buttons: {
"Cancel" : function() {
$(this).dialog("close");
},
"Yes": function() {
$("form#generate_vouchers")[0].submit(); // submit form manually
$("input#submit").hide(300, function(){
$("img#loader").show(300);
});
}
}
});
}
else{
$("input#submit").hide(300, function(){
$("img#loader").show(300);
});
}
});
Please Whitelist JSFiddle in your content blocker.
Help keep JSFiddle free for always by one of two ways:
Whitelist JSFiddle in your content blocker (two clicks)
Go PRO and get access to additional PRO features →
Join the 4+ million users, and keep the JSFiddle dream alive.
Ad-free
All ads in the editor and listing pages are turned completely off.
Fiddle Pages
Your fiddles accessible under a custom domain and a vanity path.
Use pre-released features
You get to try and use features (like the Palette Color Generator) months before everyone else.
Fiddle collections
Sort and categorize your Fiddles into multiple collections.
Private collections and fiddles
You can make as many Private Fiddles, and Private Collections as you wish!