javascript - How do I get jquery to recognize created on the fly element with .on? -
i have following code using begin animation process:
$('body').on('click','#contain span', function(){ var $target = $(this).parent().children('#contain_inner'); flyout.fadeoldbox($target); flyout.createbox(); })
flyout.createbox()
creates new instance of #contain_inner
new instance not available when click function above tries target again. know if use .live
things work deprecated , don't understand how use .on
accomplish need here.
i know using .on
above click, still don't understand how bind new #contain_inner
div create in flyout.createbox()
.
edit: showing flyout.createbox() code...all working now!
createbox: function(){ $box = $('<div id="feed_contain_inner"></div>'); //was accidentally creating div class= instead of id $box.load('example') $box.appendto('#contain'); flyout.positionbox($box); }
this same live:
$(document).on('click', '.yourslector', callback);
Comments
Post a Comment