-1

i'm have problem with confirm Jquery..

if

confirm("Confirm yes or no", function () {
        alert('button yes clicked');
    });

this mean, if i click button "Yes" this show alert("button yes clicked") , but how is i'm click button "No " ? i'm want to run alert (button No clicked)

thanks.. sorry for my english

bukanamay
  • 577
  • 5
  • 11
  • 26

1 Answers1

1

This is not jquery, this is native javascript. confirm returns a boolean. Simply set the confirm to a variable, and check if there is a response or not.

var response = confirm("Confirm yes or no");
if (response) console.log("Yes");
else console.log("No");
Sterling Archer
  • 22,070
  • 18
  • 81
  • 118