Use on() (as @techfoobar mentioned, live() is deprecated in version 1.7 and removed as of version 1.9) and event delegation if the content is dynamically generated:
$('#container').on('click', '#testlink', function(){
alert('testlink');
});
Where #container
is an element containing the dynamically loaded #testLink
element (you could use document
, but using a container element here reduces the search scope and increases efficiency).