Loading…

What are the difference between alert() and confirm()?

Alert()- it is a pop up that is intended for the user to click the OK button and vanish once you click.

Confirm ()- it is a wider choice and gives 2 options to the user to choose. It is basically like an if-else statement.

Example

                                        

Display message with alert() and confirm()

alert('Are you sure to delete this item?');
confirm("Are you sure to delete this item?");

Suggest An Answer

No suggestions avaliable!

Latest post from JQuery interview questions

Ask Question