title: Apply same function autocomplete to multiple input boxes javascript
body: <p>I have an autocomplete javascript function that I don't know how to use for multiple input boxes on the same page. I have tried a lot of things and for some reason it breaks the script here is the code and how I am doing it now..</p>
  
  <pre><code>&lt;link href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.1/themes/base/jquery-ui.css" rel="stylesheet" type="text/css"/&gt;
  &lt;script type="text/javascript"&gt;
      $(document).ready(function() {
          SearchText();
      });
    function SearchText() {
          $(".autosuggest").autocomplete({
  
               select:function(event, ui){
                window.location.href = '/Products/ProductInfoCenter.aspx?partnum=' + ui.item.value;
             },
              source: function (request, response, ui) {
                  $.ajax({
                      type: "POST",
                      contentType: "application/json; charset=utf-8",
                      url: "/test.aspx/GetAutoCompleteData",
                      data: "{'PartNumber':'" + document.getElementById('txtPartNum').value + "'}",
                      dataType: "json",
                      success: function (data) {
                         response(data.d);
                      },
                      error: function (result) {
                          alert(err.message);
                      }
                  });
              }
          });
      }
  
  &lt;/script&gt;
  </code></pre>
  
  <p>And the input boxes...</p>
  
  <pre><code>   &lt;input type="text" id="txtPartNum" class="autosuggest" /&gt;
     &lt;input type="text" id="txtPartNum" class="autosuggest" /&gt;
  </code></pre>
  
  <p>of course this does not work though..</p>
  
  <p>Thank you and please help</p>