DZone Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world

Snippets has posted 5883 posts at DZone. View Full User Profile

Focus To First Input (greasemonkey)

01.01.2009
| 5387 views |
  • submit to reddit
        // kakšen kmet morš bit da ne daš fokusa na input

for (i=0; document.getElementsByTagName('input').length; i++) {
    if(document.getElementsByTagName[i].type == 'text') {
        document.getElementsByTagName[i].focus();
        exit;   
    }
}