January 2020
Intermediate to advanced
470 pages
11h 13m
English
Let's consider a simple but common situation. You have developed an e-commerce site; the user can fill their shopping cart, and in the end, they must click on a Bill me button so their credit card will be charged. However, the user shouldn't click twice (or more) or they will be billed several times.
The HTML part of your application might have something like this somewhere:
<button id="billButton" onclick="billTheUser(some, sales, data)">Bill me</button>
And, among the scripts, you'd have something similar to the following code:
function billTheUser(some, sales, data) { window.alert("Billing the user..."); // actually bill the user}
Read now
Unlock full access