Ciao Ragazzi,
il problema sono sicuro sia banalissimo ma di jQuery non ne mastico. Ho trovato il seguente codice:

codice:
<!doctype html>
 
<html lang="en">
<head>
  <meta charset="utf-8" />
  <title>jQuery UI Autocomplete - Remote JSONP datasource</title>
  <link rel="stylesheet" href="http://code.jquery.com/ui/1.10.1/themes/base/jquery-ui.css" />
  <script src="http://code.jquery.com/jquery-1.9.1.js"></script>
  <script src="http://code.jquery.com/ui/1.10.1/jquery-ui.js"></script>

  <script>
  $(function() {
    function log( message , id ) {
	$('input[id='+id+']').val(message);
    }

	
 
    $( "#city" ).autocomplete({
      source: function( request, response ) {
        $.ajax({
          url: "http://ws.geonames.org/searchJSON",
          dataType: "jsonp",
          data: {
            featureClass: "P",
            style: "FULL",
            maxRows: 12,
            lang:"it",		
            name_startsWith: request.term
          },
          success: function( data ) {
            response( $.map( data.geonames, function( item ) {
              return {
                label: item.name + (item.adminName1 ? ", " + item.adminName1 : "") + ", " + item.countryName,
                value: item.name
              }
            }));
          }
        });
      },
      minLength: 2,
      select: function( event, ui ) {
        log( ui.item ?
          ui.item.label :
          "ERRORE",$(this).attr('id'););
      },
      
    });
  });
  </script>
</head>
<body>
 
<div class="ui-widget">
  <label for="city">Your city: </label>

<input id="city"  />
<input id="city2"   />
</div>
 

</body>
</html>

Quando utilizzo il DOM 'city' funziona ma ora vorrei poter fare lo stesso con 'city2' quindi richiamando la stessa funzione.

Aiutino?