# Autocomplete field in ajax response html - css does not get

**URL:** <https://www.ruby-forum.com/t/autocomplete-field-in-ajax-response-html-css-does-not-get/111569>\
**Category:** Rails\
**Created:** [August 8, 2007, 6:13pm UTC](https://www.ruby-forum.com/t/autocomplete-field-in-ajax-response-html-css-does-not-get/111569 "2007-08-08T18:13:05Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![bakki](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/6a8cbe/32.png) [@bakki](https://www.ruby-forum.com/u/bakki)\
**Post date:** [August 8, 2007, 6:13pm UTC](https://www.ruby-forum.com/t/autocomplete-field-in-ajax-response-html-css-does-not-get/111569/1 "2007-08-08T18:13:05Z")

</div>

Hi all,

I have a page in which a div is updated with some html via Ajax. The  
returned html contains an autocomplete field. The autocomplete field  
works but the drop down results div does not get css applied to it so  
the  
selections don’t get highlighted when I use the up/down arrows and so  
I am unable to select from the drop down except for the first item. I  
have been looking at this in firebug for hours but can’t see the  
difference between a working autocomplete on a normal page and the one  
in an  
Ajax div.

Any help/pointers/illuminations will be greatly appreciated. Thanks,

bakki

---

<div class="post-metadata">

**Author:** ![bakki](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/6a8cbe/32.png) [@bakki](https://www.ruby-forum.com/u/bakki)\
**Post date:** [August 8, 2007, 7:19pm UTC](https://www.ruby-forum.com/t/autocomplete-field-in-ajax-response-html-css-does-not-get/111569/2 "2007-08-08T19:19:25Z")

</div>

Solved!

The problem was hinted at by the “$(element) has no properties” error  
I was getting in firebug. I then realized that the text\_field was  
wrapped in

 and the results 
 and the auto\_complete\_field  
were outside so prototype couldn’t find the elements. I just moved the to the bottom of the \<%= auto\_complete\_field ..... %\> which solved the problem.

-bakki
