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

Popular posts from this blog

linux - Does gcc have any options to add version info in ELF binary file? -

android - send complex objects as post php java -

charts - What graph/dashboard product is facebook using in Dashboard: PUE & WUE -