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

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;
Who is Participating?
honestman31Connect With a Mentor Commented:
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

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
Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

MeinhoonaaAuthor Commented:
I am looking for solution not mere links which I can find myself.
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
MeinhoonaaAuthor Commented:
thank you
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.