java script alert yes no – Alert Yes No With the confirm() Function in JavaScript. You can create a JavaScript confirmation box that offers “yes” and “no” options by using the confirm() method.
java script alert yes no
The confirm method takes a single string argument, and you can pass a message which you want to display in a dialog box.
How to create a dialog with “yes” and “no” options?
if (confirm('Are you sure you want to save this thing into the table?')) { // Update it! console.log('Thing was saved to the table.'); } else { // Do nothing! console.log('Thing was not saved to the table.'); }
Create a Dialog Using the confirm() Function in JavaScript
var dialog = confirm("Update data?"); if (dialog) { console.log('Data Saved') } else { console.log('Data Not Saved') }
Example
index.html
JavaScript confirmation box - www.pakainfo.com Call the confirmation box - Example
Don’t Miss : Javascript Confirm Delete Yes No
How to create a dialog with “yes” and “no” options in JavaScript?
index.html
I hope you get an idea about java script alert yes no.
I would like to have feedback on my infinityknow.com.
Your valuable feedback, question, or comments about this Article are always welcome.
If you enjoyed and liked this post, don’t forget to share.