passing callback function into onclick event
<p>Ive been messing with this a while and have tried numerous ways. It still wont work.</p>

<pre><code>function popupConfirm(widtH, texT, callback){ 
var top=(window.innerHeight/2) - 100;
var left=(window.innerWidth/2) - (widtH/2);
var r="&lt;div id='standard-modal' style='width:"+widtH+"px;top:"+top+"px;left:"+left+"px;'&gt;";
        r+="&lt;div id='standard-modal-header' style='width:"+(widtH-4)+"px;'&gt;";
        r+="&lt;strong&gt;&amp;rarr; &amp;nbsp; Icon Box &amp;nbsp; &amp;larr;&lt;/strong&gt;";
        r+="&lt;/div&gt;";
        r+="&lt;div id='standard-modal-message' style='width:"+(widtH-30)+"px;'&gt;"+texT+"&lt;/div&gt;";
            r+="&lt;div id='button_wrapper'&gt;&lt;div id='standard-modal-button' class='left_button' onclick='$(\"#standard-modal\").remove();' &gt;CANCEL&lt;/div&gt;";

            // following line attaches callback to onclick event        
            r+="&lt;div id='standard-modal-button' class='right_button' onclick='callback();' &gt;CONFRIM&lt;/div&gt;&lt;/div&gt;";
        r+="&lt;div style='clear:both;'&gt;&lt;/div&gt;&lt;/div&gt;";

$('body').append(r);
}


popupConfirm(300,'blah blah' , function(){alert("finally");});    
</code></pre>

<p>in theory, i want it to do the alert once the user clicks confirm in my popup...  any help is appreciated.</p>

<p>its logs to the console 'callback is not defined'</p>
