jQuery append is invisible? -


i using append add text div container when link clicked. new text appended link. when new text link clicked jquery event have attached event not happen.

if paste appended code straight html event caught, it's if appended html cannot seen. have mis-understood how jquery append function works?

thanks,

alan.

edit **

code:

$(function(){

$('.tab-link').click(function(){       alert('hello');  });  $('.tab-copy').click(function(){       var next=$(this).data("next");       $('#tabs-row-left').append('<div class=\"tab-folder\" id=\"idtab'+next+'\"><a href=\"#\" class=\"tab-link\" id=\"tab'+next+'\" data-strategyid='+(next+1)+'>test</a></div>');   }); 

});

here js fiddle:

http://jsfiddle.net/m6wcj/

if click plus sign see new text appear, should clickable exisiting text , should alert 'hello' doesn't. weird!

it's sounds need change your event binding 'on', this:

$('#container').on('click', 'a', function(){     //dosomething. }) 

Comments

Popular posts from this blog

Unable to remove the www from url on https using .htaccess -