1
rated 0 times
[
6]
[
5]
/ answers: 1 / hits: 15428
/ 13 Years ago, thu, january 26, 2012, 12:00:00
Ive been messing with this a while and have tried numerous ways. It still wont work.
function popupConfirm(widtH, texT, callback){
var top=(window.innerHeight/2) - 100;
var left=(window.innerWidth/2) - (widtH/2);
var r=<div id='standard-modal' style='width:+widtH+px;top:+top+px;left:+left+px;'>;
r+=<div id='standard-modal-header' style='width:+(widtH-4)+px;'>;
r+=<strong>→ Icon Box ←</strong>;
r+=</div>;
r+=<div id='standard-modal-message' style='width:+(widtH-30)+px;'>+texT+</div>;
r+=<div id='button_wrapper'><div id='standard-modal-button' class='left_button' onclick='$(#standard-modal).remove();' >CANCEL</div>;
// following line attaches callback to onclick event
r+=<div id='standard-modal-button' class='right_button' onclick='callback();' >CONFRIM</div></div>;
r+=<div style='clear:both;'></div></div>;
$('body').append(r);
}
popupConfirm(300,'blah blah' , function(){alert(finally);});
in theory, i want it to do the alert once the user clicks confirm in my popup... any help is appreciated.
its logs to the console 'callback is not defined'
More From » jquery