Select "Cancel" in Alert by default

Asked

Viewed 220 times

2

As you all know confirm of the JS will show a Alert with the informed text and options CANCEL and OK. And just like that, the OK is always selected and this way disturbs (in my case at least). There is the possibility to keep the CANCEL selected instead of the OK?

3 answers

2

1

Friend this is not possible with javascript. In this case I suggest you create your own popup. Bootstrap offers cool and simple alerts to be implemented.

http://getbootstrap.com/javascript/

1

You cannot do this. The focus of the default option is even OK. Instead of confirm you can use the library below.

http://tristanedwards.me/sweetalert

In addition to solving your problem, it improves the usability of your site, as it produces something more friendly.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.