asked on June 18, 2020
Hi, I am looking for help on the correct javascript that would accomplish clearing three input fields and pop up confirmation dialog within collection. I can archive for only the first collection, while 2nd or latter collections have no effect at all. Laserfiche guide have some samples, but seems not similar to my case.
Below is my code and part of screenshot.
Any help/guide will be much appreciated.
$(document).ready(function() { var person, totalamount, amountperperson; var maxlimit; //check when Amount per Person change $('.MealAmountPerson').on('change', function() { totalamount= $('.MealAmount input').val(); amountperperson = parseFloat($('.MealAmountPerson input').val()); person=$('.Person input').val(); maxlimit=parseInt($('.Maxlimit input').val(),10); if ( (amountperperson>maxlimit) && (totalamount != '') && (person != '')) { // Empty no. of person,Total Amount, Amount per Person $('.Person input').val(''); $('.MealAmount input').val(''); $('.MealAmountPerson input').val(''); $('#WindowShade').addClass('Opened'); $('#ConfirmationDialog').addClass('Opened'); showConfirmDialog(); } }); function showConfirmDialog() { //Submit the form if the user presses the Yes button on the confirmation. $('#ConfirmationDialog .confirm-yes').on('click', function() { $('#WindowShade').removeClass('Opened'); $('#ConfirmationDialog').removeClass('Opened'); }); } });
0
0