Monday, June 3, 2024
 Popular · Latest · Hot · Upcoming
77
rated 0 times [  78] [ 1]  / answers: 1 / hits: 37113  / 15 Years ago, mon, november 9, 2009, 12:00:00

I am displaying a JavaScript confirm box when the user clicks on the Delete Data button. I am displaying it as shown in this image:



alt



In the image, the OK button is selected by default. I want to select the Cancel button by default, so that if the user accidentally presses the enter key, the records will be safe and will not be deleted.



Is there any way in JavaScript to select the Cancel button by default?


More From » jquery

 Answers
26

If you can use jQuery plugin then here is a nice one



jQuery Impromptu



To change the default focused button:



$.prompt('Example 4',{ buttons: { Ok: true, Cancel: false }, focus: 1 });

[#98359] Thursday, November 5, 2009, 15 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
yamileth

Total Points: 53
Total Questions: 96
Total Answers: 112

Location: England
Member since Tue, Sep 8, 2020
4 Years ago
;