How to replace confirm dialog box OK/Cancel with YES/NO in Javascript

Meinhoonaa used Ask the Experts™
How do I  replace confirm dialog box OK/Cancel with YES/NO in Javascript?

<asp:TextBox ID="plateQty" runat="server" Width="50px" onblur="validate(this)" maxlength="2" CssClass="TRAStext" Text='<%#Container.DataItem("qty")%>'></asp:TextBox>

function validate(_this) {
            if (_this.value >= "5") {
                var retVal = confirm("Are you sure you want to order " + _this.value + " boxes?");
                if (retVal == true) {
                    return true;
                else {
                    _this.value = "";
                    return false;
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
You cannot do that with the native confirm() as it is of browser's method.
you  will need to use usejQuery UI

More info ( and source )
also please check this

it will be great help for you , just copy and paste the  code u want
don't forget to copy this file to your server msg-box.js


I am looking for solution not mere links which I can find myself.
Success in ‘20 With a Profitable Pricing Strategy

Do you wonder if your IT business is truly profitable or if you should raise your prices? Learn how to calculate your overhead burden using our free interactive tool and use it to determine the right price for your IT services. Start calculating Now!

this   has the solution , just choose what you want and copy and paste the code ,

P.S. to view the source code  use  CTR + U
Here is a fully working code , I hope that what you want

<!doctype html>
<html lang="en">
    <meta charset="utf-8" />
    <title>jQuery UI Dialog - Modal confirmation</title>
    <link rel="stylesheet" href="" />
    <script src=""></script>
    <script src="/resources/demos/external/jquery.bgiframe-2.1.2.js"></script>
    <script src=""></script>
    <link rel="stylesheet" href="/resources/demos/style.css" />
    $(function() {
        $( "#dialog-confirm" ).dialog({
            resizable: false,
            modal: true,
            buttons: {
                "YES": function() {
                    $( this ).dialog( "close" );
                "NO": function() {
                    $( this ).dialog( "close" );
<div id="dialog-confirm" title="Are you sure ?">


Open in new window



thank you

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial