Prototype Autocompleter Width

Prototype’s Autocompleter is really nice and easy to use, but out of the box it bases the width of the dropdown div on the corresponding text input. Check out line 4 here which contains the runoff of line 3 as well as the normal line 4 content.


Of course, it’s simple to stop the line from wrapping but much nicer to just take the width restriction off.


Just add setWidth: false at line 70 of controls.js, like so:

Position.clone(element, update, {
setHeight: false,
setWidth: false,
offsetTop: element.offsetHeight



Filed under Uncategorized

3 responses to “Prototype Autocompleter Width

  1. Foobar

    Or, set the response LI to display:block so that it wraps neatly

  2. Thanks a lot… it resolve my problem

    @Foobar Btw your method didn’t work for me !

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s