I have a function like this:
$(".link").click(function (){ ... }
Works well.
Now i use $("#new").load("test.htm"); and this html file contains something like
<a href="#" class="link" data-name="foo">Hello</a>
The link appears but all clicks on it will be ignored.
I'm sure this has something to do with later added content into the DOM or something.
I've found this statement here but don't know if it applies to my problem:
Because you are inserting the content AFTER the DOM has been fully loaded, you have to use .on("click",function(){}) to achieve your click functionality because at the time you are binding them they are not available in the DOM !
How can i fix that? Thank you!