Javascript Confirm popup Yes, No button instead of OK and Cancel
Unfortunately, there is no cross-browser support for opening a confirmation dialog that is not the default OK/Cancel pair. The solution you provided uses VBScript, which is only available in IE.
I would suggest using a Javascript library that can build a DOM-based dialog instead. Try Jquery UI: http://jqueryui.com/
Make javascript alert Yes/No Instead of Ok/Cancel
You can use jQuery UI Dialog.
These libraries create HTML elements that look and behave like a dialog box, allowing you to put anything you want (including form elements or video) in the dialog.
Yes/No buttons instead of OK/Cancel in a confirm() dialog?
I don't believe so. In JS, confirm()
is specified to only use the OK and Cancel buttons.
If you want something more complicated, you'll have to make your own dialog, or use a third-party one that provides your desired functionality (yes, including jQuery, unfortunately).
How to create a dialog with “Ok” and “Cancel” options
You’re probably looking for confirm()
, which displays a prompt and returns true
or false
based on what the user decided:
if (confirm('Are you sure you want to save this thing into the database?')) { // Save it! console.log('Thing was saved to the database.');} else { // Do nothing! console.log('Thing was not saved to the database.');}
Yes or No buttons on confirmation box
You can't do this with confirm
. There is no way to customize the buttons of the native alert
/confirm
/etc dialogs.
You could make a DOM-based dialog instead, and customize the elements to your liking.
how to create yes/no/cancel box in javascript instead of ok/cancel?
You can't.
Instead, you can use a fake dialog library, such as jQuery UI Dialog.
These libraries create HTML elements that look and behave like a dialog box, allowing you to put anything you want (including form elements or video) in the dialog.
Related Topics
Contenteditable, Set Caret At the End of the Text (Cross-Browser)
Html Form Readonly Select Tag/Input
How to Open a Pdf File in an ≪Iframe≫
Good Tutorial For Using Html5 History API (Pushstate)
Browser Detection Versus Feature Detection
How to Correctly Iterate Through Getelementsbyclassname
Link Index.Html Client.Js and Server.Js
How Can JavaScript Upload a Blob
Fastest Method to Escape HTML Tags as HTML Entities
Get Pixel Color from Canvas, on Mousemove
How Is the Default Submit Button on an HTML Form Determined
How to Properly Use Jspdf Library
How to Clear the Canvas For Redrawing
Can You Style an HTML Radio Button to Look Like a Checkbox