jquery simplemodal unable to call another function -


in modal window have "continue" button. whilst can modal close assigning button simplemodal-close class, can't call function. i've put code simple demos on site.

the button:

<a href="#" class="simplemodal-close" onclick="closepopup()"><img src="bell/images/button_understand.gif" width="116" height="49"></a> 

the javascript:

$(document).ready(function() {     function showpopups(){         var e = document.getelementbyid('hirpopup');         $('#hirpopup').modal({         opacity:80,         overlaycss: {backgroundcolor:"#fff"}         });     e.style.display = 'block';     return false;     }      function closepopup(){         var e = document.getelementbyid('hirpopup');         e.style.display = 'none';          confirm(function () {         samewindow(this.form);         });     }      function confirm(callback) {         $('#hirpopup').modal({             onshow: function () {                 var modal = this;                 // call callback                 if ($.isfunction(callback)) {                     callback.apply();                 }             }         });     } }); 

any ideas i'm pretty new jquery , new simplemodal.

edit: i've updated javascript follows, still not doing function. alert of 1, , alert function in nothing else.

$(document).ready(function(){     $("#close").css("cursor", "pointer");       $('#next').click(function(){         var e = document.getelementbyid('hirpopup');         $('#hirpopup').modal({             opacity:80,             overlaycss: {backgroundcolor:"#fff"}         });         e.style.display = 'block';         return false;     });      $('#close').click(function(){         var e = document.getelementbyid('hirpopup');         e.style.display = 'none';          confirm(function () {             samewindow(this.form);         });     }); });   function confirm(callback) { alert("1"); alert(callback);     $('#hirpopup').modal({         onshow: function () {             alert("2");             var modal = this;             // call callback             if ($.isfunction(callback)) {                 alert("3");                 callback.apply();             }         }     }); } 

edit: may try put confirm method inside document.ready. 1 issue

you cannot have $(document).ready inside own function, should root method. use jquery event binding

    $(document).ready(function() {  $('.simplemodal-close').click({          var e = document.getelementbyid('hirpopup');         e.style.display = 'none';          confirm(function () {             samewindow(this.form);         });  }); 

});


Comments

Popular posts from this blog

android - Spacing between the stars of a rating bar? -

html - Instapaper-like algorithm -

c# - How to execute a particular part of code asynchronously in a class -