Question

I want to show a confirmation box include 4 options: Yes/No/Yes to All/No to All after user click a button in my aspx page. I have seen a lot of sample but it only contain Yes/No option. Please show me the way to do that.

Was it helpful?

Solution

There's no native javascript function for that (I guess you saw samples that are using confirm function).

Give a try to a javascript library, that create pseudo dialog.

One of the most used is JQueryUI. Especially, look at the Dialog confirmation sample, and you'll ends with something like:

<script>
  $(function() {
    $( "#dialog-confirm" ).dialog({
      resizable: false,
      height:140,
      modal: true,
      buttons: {
        "Yes": function() {
          // Handler for Yes
        },
        "No": function() {
          // Handler for No
        },
        "Yes to all": function() {
          // Handler for Yes to all
        },
        "No to all": function() {
          // Handler for no to all
        }
      }
    });
  });
  </script>
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top