Create your own flag to confirm:
<div id="confirmBox"> <div class="message"></div> <span class="yes">Yes</span> <span class="no">No</span> </div>
Create your own confirm() method:
function doConfirm(msg, yesFn, noFn) { var confirmBox = $("#confirmBox"); confirmBox.find(".message").text(msg); confirmBox.find(".yes,.no").unbind().click(function() { confirmBox.hide(); }); confirmBox.find(".yes").click(yesFn); confirmBox.find(".no").click(noFn); confirmBox.show(); }
Call it by your code:
doConfirm("Are you sure?", function yes() { form.submit(); }, function no() {
You need to add CSS to the style and place the confirmation box correctly.
Working demo: jsfiddle.net/Xtreu
gilly3 Jun 22 '11 at 20:29 2011-06-22 20:29
source share