# Refocus on text\_field

**URL:** <https://www.ruby-forum.com/t/refocus-on-text-field/128181>\
**Category:** Rails\
**Created:** [February 5, 2008, 5:30pm UTC](https://www.ruby-forum.com/t/refocus-on-text-field/128181 "2008-02-05T17:30:17Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![snantz](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/c2a13f/32.png) [@snantz](https://www.ruby-forum.com/u/snantz)\
**Post date:** [February 5, 2008, 5:30pm UTC](https://www.ruby-forum.com/t/refocus-on-text-field/128181/1 "2008-02-05T17:30:17Z")

</div>

I have this textfield that appears as a drop down section whithin a form  
when a link is clicked - so it is it’s own partial. The idea is that a  
value can be entered within that field and then added to a list, but I  
need the cursor to re-focus on that text field so lots and lots of  
values can be inputed without having to reclick on that field everytime.

When the form is submitted I clear the textfield by saying:  
:complete =\> 'document.getElementById(“value”).value = “”;  
in my form\_remote\_tag, but adding this:  
document.getElementById(“value”).focus();  
doesn’t do what I would like it to do. Anyone have an suggestiosn on how  
to do this\> Thanks,

-S
