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
Post a Comment