dont detect new element prepend by jquery

dont detect new element prepend by jquery

Hi, im starting with jquery and im trying to prepend a li to my ul list
  1. $.ajax({
  2. type: "POST",
  3. url: "gethtml.php",
  4. cache: false,
  5. data:
  6. {
  7. id : $('#input_id').val()
  8. },
  9. success: function(html){
  10. $("ul#list").prepend(html);
  11. $("ul#list li").show();
  12. },
  13. error:function(XMLHttpRequest,textStatus,errorThrown)
  14. {
  15. alert(textStatus);
  16. }
  17. });
  18. this html would be like ... <li><a href="#" id="1">Link</a></li>
  19. then i wil try to do this function when click on this links
  20. $("a").click(function(){
  21. alert( $(this).attr('id') );
  22. });

  23. if i load the page and i click on thoses default <li><a href="#" id="1">Link</a></li> works but if prepend with jqueryi click the new li <li><a href="#" id="2">Link 2</a></li> doesnt works until i refresh the page.

  24. Thanks!