Best way to manage .click() and .delegate() on a page

Best way to manage .click() and .delegate() on a page

Hi all,

I load a static page, inside this page there are links like this:

  1. <a href="some/path/here/with/id" class="update">Click</a>
With this function I can change the link value (Click) with a second value depending on ajax response.

  1. $('.update').click(function(event) {
  2.       event.preventDefault();
  3.       $.post('script.php', {}, function(data){
  4.             // Depending on the value that data has i change the link:
  5.             <a href="some/path/here/with/id" class="update">Clicked!</a>
  6.             // Then I replace the link
  7.       });
  8. }
Ok, the question starts here: When I replace the link .click() doesn't work anymore I need to use .delegate() that works pretty good.

I need to create two functions, one for each case (.click() and .delegate()) or is there (I'm sure there is, but I don't know) a better way to do that?