Can't get jQuery UI autocomplete working The text field that is created seems to just act like a normal textfield, no autocomplete function or any indication that it works at all.

There's no errors in the console. I've run checks to see if jQuery UI is loading, it is. I'm using jQuery Update module, so both libraries are at version 1.10.

I'm using the Bootstrap theme, but I've tried disabling that and using Bartik, it makes no difference.

Any ideas?

Here's the form alter function I'm using in my module. It fires just fine.

function mymodule_form_mymodule_form_newlead_alter (&amp;$form, &amp;$form_state) {

    $form['business_category'] = array(
        '#title' =&gt; t('Business Category'),
        '#description' =&gt; t('Category' ),
        '#type' =&gt; 'textfield',
        '#id' =&gt; 'business_category',
        '#attached' =&gt; array(
            'library' =&gt; array(
                array('system', 'ui.autocomplete'),
            ),
            'js' =&gt; array(
                drupal_get_path('module', 'mymodule') . "/custom.js",
            ),
        ),
    );

}


Here's custom.js

(function ($) {

        $( "#business_category" ).autocomplete({
            source: [ "cat1", "cat2", "cat3" ]
        });

})(jQuery);
Adding drupal behaviours, as suggested by @2pha, did the trick:

(function ($) {
    Drupal.behaviors.infiniteScrollAddClass = {
        attach: function (context, settings) {

            $( "#business_category" ).autocomplete({
                source: [ "cat1", "cat2", "cat3" ]
            });
        }
    }

})(jQuery);