I have the following piece of code:
function checkAmount() {
var PayField = document.getElementById('paymentamount');
var Pound = document.getElementById('pound');
if (PayField.value == "") {
PayField.style.border = '1px #F00 solid';
Pound.style.color = '#F00';
alert('You need to enter an amount that you wish to donate');
return false;
}
return true;
}
When a user types a valid amount and clicks the pay button, the form should wait 3 seconds then submits after waiting 3 seconds.
I’ve tried using setTimeout() with it, but it doesn’t work at all. I don’t want to use jQuery with this, can you provide me a code how to do it.
Add an ID to your form:
Then, in your JavaScript: