views:

10

answers:

0

I'm using the jQuery autocomplete widget. I have it implemented in a plain page. It works beautifully.

I embed the autocomplete control in a modal window and I'm getting an error:

$.ui.position is undefined

    $.each( [ "left", "top" ], function( i, dir ) {
        if ( $.ui.position[ collision[i] ] ) {
            $.ui.position[ collision[i] ][ dir ]( position, {
                targetWidth: targetWidth,
                targetHeight: targetHeight,
                elemWidth: elemWidth,
                elemHeight: elemHeight,
                offset: offset,
                my: options.my,
                at: options.at
            });
        }
    });

The second line is the offending code. Position is undefined.

Any idea's?

Update

I added a check for the undefined position. It fixed the error, but the up down keys don't work to traverse the options.

code

    $.each( [ "left", "top" ], function( i, dir ) {
        if ( $.ui.position !== undefined && $.ui.position[ collision[i] ] ) {
            $.ui.position[ collision[i] ][ dir ]( position, {
                targetWidth: targetWidth,
                targetHeight: targetHeight,
                elemWidth: elemWidth,
                elemHeight: elemHeight,
                offset: offset,
                my: options.my,
                at: options.at
            });
        }
    });