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

powershell Start-Process exit code -1073741502 when used with Credential from a windows service environment -

twig - Using Twigbridge in a Laravel 5.1 Package -

c# - LINQ join Entities from HashSet's, Join vs Dictionary vs HashSet performance -