-1

I have some code that uses confirm() to prompt the user to answer a Yes or No question.

Unfortunately, my client absolutely insists that the buttons must say "Yes" and "No" instead of "OK" and "Cancel".

Even more unfortunately, I absolutely cannot use jQuery as this is a very large project and I work for a very large company and including jQuery would require full regression testing.

What's the best way to go about this? Links or code samples would be greatly appreciated!

Reinstate Monica Cellio
  • 25,975
  • 6
  • 51
  • 67
Don Moore
  • 31
  • 1
  • 1

2 Answers2

5

you should edit the html on the linked page (change to yes/no) and put it on your own site to actually collect values, but the following js works in IE, FF, and chrome. It's not modal in chrome, but at least the JS waits for the dialog to close, so it's a drop-in replacement (synchronous) for confirm/prompt/whatever...

showModalDialog("http://danml.com/pub/prompt.html", "hello" ,"world")
dandavis
  • 16,370
  • 5
  • 40
  • 36
  • Just 18 more +1s, and you'll get a gold badge for this answer. :-) – Scott Mermelstein Oct 03 '13 at 16:04
  • it's a shame that showModalDialog isn't better known. it had issues in single-digit-version chrome, but that was a long time ago, and it even works in IE7... – dandavis Oct 03 '13 at 16:05
  • You may want to submit your answer to the duplicated question as it seems to be making good point! – Jan Zyka Oct 03 '13 at 16:19
  • 1
    According to this link, showModalDialog is now deprecated: https://developer.mozilla.org/en-US/docs/Web/API/Window.showModalDialog – Bryan Larson Jul 30 '14 at 18:53
  • @BryanLarson: i know; chrome is pulling the plug any version now. my, how things change in 9 months... – dandavis Jul 30 '14 at 20:35
0

Copy the style/html of jqueryUI dialog , and attach two events (yes /no) and put the code of "visible/notvisible" there and you will have your own dialog , for sure it is not general porpuse dialog , unless you want to add more code to make it more flexible

sino
  • 754
  • 1
  • 7
  • 22