Using .live() with .each()

Using .live() with .each()

Hello all,

I have a function that I apply to every anchor tag in a div called listnav. I do so like this:

  1.         $('.listnav a').each(function(i, el) {
  2.             $(el).click(function(ev) {
  3.                 ev.preventDefault();
  4.                 var href = $(this).attr('href');
  5.                 $('.listnav a').removeClass('hit');
  6.                 $(this).addClass('hit');
  7.                 load(href);
  8.             });
  9.         });
This,among other things, causes a function called load to be called on the href of the anchor. This works fine. Howver I want to use the live() function with this as I am going to dynamically change the links in the listnav div. I tried doing it like this :

  1.         $('.listnav a').each(function(i, el) {
  2.             $(el).live('click',function(ev) {
  3.                 ev.preventDefault();
  4.                 var href = $(this).attr('href');
  5.                 $('.listnav a').removeClass('hit');
  6.                 $(this).addClass('hit');
  7.                 load(href);
  8.             });
  9.         });   

But that does not work. My question is how would I go about changing this function so that the actions are applied to any new anchors added to the div dynamically? I'm assuming I have a syntax error of some kind here but am just not sure what I should change. Any advice is appreciated, thanks!