function Purchase() {
document.getElementById("Button1").innerHTML = "Purchasing..."
window.setTimeout(() => {
document.getElementById("Button1").innerHTML = "Done!"
}, 3000)
}
is that what you need?
A couple of issues in your post:
30000
in milliseconds is 30 seconds
Also, you were calling Purchase()
inside of your Purchase
function making your function recursive and will make Purchase being executed over and over again
Also, setTimeout
takes a function reference (not a function execution) as the first argument that will be executed after the interval you set as the second argument. Adding ()
in setTimeout(Purchase())
will cause the Purchase
function to be executed straight away.