title: Get focused form field id in jQuery
body: <p>I am currently modifying an out-of-the-box php/jQuery autosuggestion script. I am struggeling with getting the script to work with multiple text input fields.
  It is originally made to work with ONE field.</p>
  
  <p>Here is the originale script and form code:</p>
  
  <pre><code>function suggest(inputString){
      if(inputString.length == 0) {
          $('#suggestions').fadeOut();
      } else {
      $('#city').addClass('load');
          $.post("autosuggest.php", {queryString: ""+inputString+""}, function(data){
              if(data.length &gt;0) {
                  $('#suggestions').fadeIn();
                  $('#suggestionsList').html(data);
                  $('#city').removeClass('load');
              }
          });
      }
  }
  
  function fill(thisValue) {
      $('#city').val(thisValue);
      setTimeout("$('#suggestions').fadeOut();", 0);
  }
  </code></pre>
  
  <p>The approach to modify the script to work with multiple input fields, i believe, would be to get the focused form elements' id and then do something like this:</p>
  
  <pre><code>function getFocusID() {
      // get the focused form field id here
  }
  
  if(focusedID == "city") {
      //Script for form field with "city" as id
  
      function suggest(inputString){
          if(inputString.length == 0) {
              $('#suggestions').fadeOut();
          } else {
          $('#city').addClass('load');
              $.post("autosuggest.php", {queryString: ""+inputString+""}, function(data){
                  if(data.length &gt;0) {
                      $('#suggestions').fadeIn();
                      $('#suggestionsList').html(data);
                      $('#city').removeClass('load');
                  }
              });
          }
      }
  
      function fill(thisValue) {
          $('#city').val(thisValue);
          setTimeout("$('#suggestions').fadeOut();", 0);
      }
  } // code for input id "city" END
  
  // And now create if else statements for the other 4 input text fields, filling them with the code above.
  </code></pre>
  
  <p>Am i thinking correct here? Or is there any other more efficient way to do this?
  And if this is the correct approach, how  do i get the inpud id of the focused input text field?</p>