im trying to make a popup that comes up to confirm a users action (deleting a row in a table, for example..). aiming at making the popup entirely HTML and Javascript. What i
you can implement something like this
makePopup("Are you sure?", function {
//bla bla
});
which will call your callback only if user sure, after he clicks a button or whatever. Smth like:
function makePopup(msg, callback) {
$("#sureformmsg").html(msg);
$("#sureform").show().submit(function() { if (..check..) callback(); });
}
Your example:
$(document).ready(function(){
$('a').click(function(){
makePopup("Wana go to google?",function(){
window.location.replace("http://www.google.com");
});
});
});
function makePopup(msg,callback){
$('body').append("<div class='popup'><p id='themsg'>"+msg+"</p></div>");
$('#themsg').onclick(callback);
}