5

I'm trying to focus (make caret go to, as if it was clicked) a textarea and/or textfield, according to this: How to focus on a form input text field on page load using jQuery?

I really dont get why its not working. On this page: http://gojobr.com.au/blog/working-as-a-teacher/ This, does NOT work (it doesn't do anything):

$("#author").focus()

Same with this page: http://twoggle.com

$("#BlogRequestForm_name").focus()

I can hide and show elements using this selector, but .focus() does nothing. Zero. Zilch.

Any help would be much appreciated.

Using firefox (but it doesn't work in Chrome either).

Does it work for anyone else (using Firebug's console) ?

thanks gvanto

Community
  • 1
  • 1
gvanto
  • 1,936
  • 3
  • 21
  • 26

1 Answers1

5

Does it work for anyone else (using Firebug's console) ?

It works fine, however executing .focus() from the console will not steal the focus from the console window. After executing the command, close the console window (which automatically returns the focus to the web page) and the focused element will be the one you expect. Tested with Firebug/DevTools.

Fabrício Matté
  • 69,329
  • 26
  • 129
  • 166
  • I would if I knew how lol. No 'accept anwser as correct' button/link appearing for me anywhere ... ok i just did it ... gotta hit thr square Nike symbol ... (im being a bit special today) – gvanto Feb 03 '14 at 04:48