jquery - fancybox v2 div click in title -


i have following in fancybox 2 per instructions:

afterload: function() {     this.title = '<center><a href="js/download.php?file=' + '../' +  this.href + '">download</a></center>'; } 

now, possible call function title? like:

afterload: function() {     this.title = '<center><div id="loadmore">click</div></center>'; } 

and

$('#loadmore').click(function(){ alert("hi "); }); 

many thanks.

yes, possible if bind click event in delegated form.

you use .on() method way:

$(document).on("click", "#loadmore", function () {     alert("hi"); }); 

that bind click event selector #loadmore regardless exists or it's added in future (like happens in afterload callback) dom.

see jsfiddle


Comments

Popular posts from this blog

twig - Using Twigbridge in a Laravel 5.1 Package -

jdbc - Not able to establish database connection in eclipse -

firemonkey - How do I make a beep sound in Android using Delphi and the API? -