This content originally appeared on DEV Community and was authored by SnowBit
Hello everyone, I am back with a new article on how you can use window.confirm()
Browser API in JavaScript.
window.confirm()
let you to ask confirmation before performing a important action; for example: deleting something or posting something
Let's look it by an example:
const warn = confirm('You are going to delete this post, are you sure?')
This will show you a confirmation message.
Now, how you can check whether user has confirmed or not?
const warn = confirm('You are going to delete this post, are you sure?')
if(warn){
console.log('User has confirmed')
}
This content originally appeared on DEV Community and was authored by SnowBit
SnowBit | Sciencx (2021-11-30T08:23:47+00:00) How to use window.confirm(). Retrieved from https://www.scien.cx/2021/11/30/how-to-use-window-confirm-2/
Please log in to upload a file.
There are no updates yet.
Click the Upload button above to add an update.