How confirm Message Box with OK or Cancel option in ASP .NET MVC 5 (C#)?

2k Views Asked by At

I work with ASP .NET MVC 5 . I want when I click exit button in View show Message Box that Returns OK or Cancel . How can I do this ? Please help me.

1

There are 1 best solutions below

3
On BEST ANSWER

Is this what you want:

function myFunction() {
    var x;
    if (confirm("Press a button!") == true) {
        x = "You pressed OK!";
    } else {
        x = "You pressed Cancel!";
    }    
}
<!DOCTYPE html>
<html>
<body>

<button onclick="myFunction()">Try it</button>
 
</body>
</html>