link appended doesn't triger
I am working on one of my first application in jQuery and after a really bad day I got stuck in something funny. This is the code reduced at the minimum.
Basically, once created the link, I trigger it but jQuery doesn't catch the event.
-
<html>
<head>
<script type="text/javascript" src="jquery-1.3.2.js"></script>
<script type="text/javascript">
$(document).ready(function(){
$("#test").hover(function(){
$("body").append('<div id="option_modify"><a href="#">[click]</a></div>');
});
$('a').click(function(){
console.log("test");
});
});
</script>
</head>
<body>
<div id="test">TEST</div>
</body>
</html>
Regards,
Francesco