How many arguments to validate?

How many arguments are there for the confirmation field?

What does var del=confirm("Are you sure?","Delete",""); mean var del=confirm("Are you sure?","Delete",""); ?

+4
source share
4 answers

It has a single argument that represents the text. In your example, the last two arguments will be ignored. I guess this is an unsuccessful attempt to personalize buttons.

+11
source

Only the first makes sense. Any subsequent ones are ignored.

+2
source

use it only ....

 var del=confirm("Are you sure?"); 

else must be ignored ..... this is the default function in the confirmation field ... showing "ok" and "cancel" with its own

and this will return true. .if "ok" clicked .. and rteurn false ... if "cancel" clicked

+2
source

confirm accepts only one argument:

 var ans=confirm('Your message'); 

A message appears with the OK and Cancel buttons.

+1
source

Source: https://habr.com/ru/post/1316126/


All Articles