# Focus on text\_field

**URL:** <https://www.ruby-forum.com/t/focus-on-text-field/109923>\
**Category:** Rails\
**Created:** [July 20, 2007, 9:30am UTC](https://www.ruby-forum.com/t/focus-on-text-field/109923 "2007-07-20T09:30:08Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![huang\_zhimin](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/h/54ee81/32.png) [@huang\_zhimin](https://www.ruby-forum.com/u/huang_zhimin)\
**Post date:** [July 20, 2007, 9:30am UTC](https://www.ruby-forum.com/t/focus-on-text-field/109923/1 "2007-07-20T09:30:08Z")

</div>

I use ajax to dynamically display a form under a div, so i can’t put a  
javascript function to body’s onload.  
Is there any other method to focus a text\_field?

–

> **[CodeLineStatistics](https://sourceforge.net/projects/mycodeline/)**
>
> Download CodeLineStatistics for free. The code line statistics takes files and directories from GUI, counts the total files, total sizes of files, total lines, lines of codes, lines of comments and lines of blanks in the files, displays the results...

[http://rubyforge.org/projects/ropenwiki/](http://rubyforge.org/projects/ropenwiki/)
