title: How do I get element related to active input in jQuery UI Autocomplete?
body: <p>I'm trying to pass a custom form attribute (category) through jQuery UI Autocomplete to use in a product search. The form looks like <code>&lt;form id="BulkOrderForm" category="samplecategory"&gt;&lt;input&gt;&lt;/input&gt;...&lt;/form&gt;</code> and contains inputs that use the autocomplete script. There can be several forms on each page, so I need to be able to get the category value from the form that contains the active input field.</p>
  
  <p>Here's my source:</p>
  
  <pre><code>function autocomplete() {
      $("input.wcbulkorderproduct").autocomplete({
          element: function(){
              var element = $('form#BulkOrderForm').attr('category');
              return element;
          },
          source: function(request, response, element){
              $.ajax({
                  url: WCBulkOrder.url+'?callback=?&amp;action='+acs_action+'&amp;_wpnonce='+WCBulkOrder.search_products_nonce,
                  dataType: "json",
                  data: {
                      term: request.term,
                      category: element
                  },
                  success: function(data) {
                      response(data);
                  }
              });
          }
      });
  }
  </code></pre>
  
  <p>Any thoughts on how this can be acheived?</p>