title: jquery $(event.target).closest('td') getting 'lost' when calling same function more than once at the same time
body: <p>I am having a problem with the below code and I am not sure of the cause.</p>
  
  <p><strong>Scenario summary:</strong><br>
  Basically I have a page with several input fields for inline editing, whenever each one is filled, on blur or pressing enter, a javascript function is called which does the following:</p>
  
  <ul>
  <li>shows "loading" instead of the input field  </li>
  <li>does an AJAX request to a PHP file  </li>
  <li>on completion, then replaces the 'loading' with the user's value      </li>
  </ul>
  
  <p><strong>Problem</strong>:<br>
  The above is working perfectly fine if the user edits 1 input field at a time, but when the user edits a 2nd field while the first one is still 'loading', the javascript gets 'lost' and when the 1st AJAX request completes, the "loading" is still always there, but on the 2nd one it is correctly replaced.</p>
  
  <p>Below is the javascript code, I believe the JS confusion is related to "nearestTd", it is as if jquery is 'forgetting' the old nearestTd (from the first call), and only 'remembers' the new one...any suggestions please ?</p>
  
  <pre><code>function action_addSystemCountryLanguageField (event) {
  value = $(event.target).val();
  nearestTd = $(event.target).closest('td');
  var loading=nearestTd.html("&lt;div align='center'&gt;&lt;img src='images/loading-small.gif' width='15' height='15' /&gt;&lt;/div&gt;");
  
  $.ajax({
      url: 'actions/pause.php',
      type: 'POST',
      dataType: 'json',
      success: function(response, textStatus, XMLHttpRequest) {
          nearestTd.html("&lt;span class='editSystemCountryLanguage'&gt;ok&lt;/span&gt;");
      },
      error: function(XMLHttpRequest, textStatus, errorThrown) {
          if (typeof console != 'undefined')
              console.dir(XMLHttpRequest);
          return false;
      }
  });
  }
  </code></pre>
  
  <p>PHP code, just a simple pause function so I can have an AJX delay &amp; test this bug:</p>
  
  <pre><code>&lt;?php
    sleep(1.5);
  ?&gt;
  </code></pre>
  
  <p>the code on the page &amp; the jquery 'listener':</p>
  
  <pre><code>$(".addSystemCountryLanguage").live('blur', action_addSystemCountryLanguageField);
  $(".addSystemCountryLanguage").keypress(function(e) {
    if(e.keyCode == 13) {
      action_addSystemCountryLanguageField(e);
    }
  });
  </code></pre>
  
  <p>HTML:</p>
  
  <pre><code>&lt;input class='addSystemCountryLanguage' style='width:80px;  border: 0;' value='' /&gt;
  </code></pre>