Answer by sailaja.p for JavaScript alert box with confirm on button press
You can use this function: myFunction() { var x; if (confirm("Are you sure?") == true) { x = "You pressed OK!"; } else { x = "You pressed Cancel!"; } return x; } myFunction();
View ArticleAnswer by jave.web for JavaScript alert box with confirm on button press
As other answers talk about direct onclick, I would like to present a solution for a "nicer" (IMO=in my opinion) version using the addEventListener and preventDefault methods. Because this way you...
View ArticleAnswer by Kaleb Brasee for JavaScript alert box with confirm on button press
You can easily do it with a confirm onclick: <p id="accept-favor"><a title="Accept this Favor" href="?wp_accept_favor=<?php comment_ID(); ?>" onclick="return confirm('Are you sure you...
View ArticleAnswer by SLaks for JavaScript alert box with confirm on button press
You can write onclick="return confirm('Are you sure?');". The confirm function shows an OK / Cancel dialog and returns true if the user clicked OK. returning false from an onclick handler will cancel...
View ArticleJavaScript alert box with confirm on button press
I have this link: <p id="accept-favor"><a title="Accept this Favor" href="?wp_accept_favor=<?php comment_ID(); ?>">Accept this Favor</a></p> I want to show a JavaScript...
View Article