0

i'm using a 3rd party template with jQuery for one of my domains.

i'd like to call focus on the text input at dom ready, so I've tried this:

$('input[type="text"]').focus()

for whatever reason the text field will not focus, i've only tried with chrome.

here is the domain

  • open console and type $('input[type="text"]').focus()
  • expected behavior is that the users cursor is placed in the text box

its fully possible that one of the templates libraries, css or js is preventing the focus, but its all minified and compressed so I'm a little unclear as to where i can look.

random-forest-cat
  • 33,652
  • 11
  • 120
  • 99
  • ^^^ YES ^^^ open your console and type $('input[type="text"]').length .... then post that number here :O – dovidweisz Jan 18 '16 at 23:01
  • @BrettDeWoody That question explains why it doesn't work from the console, but not why it doesn't work when he tries to do it in the domready handler. – Barmar Jan 18 '16 at 23:13
  • Running `setTimeout(function(){$('input[name="url"]').focus();}, 2000)` in the console and quickly clicking to the page focuses on the input as expected. – Brett DeWoody Jan 18 '16 at 23:17
  • @lfender6445, have you tried running `focus()` in a script on the page? Or only from the console? – Brett DeWoody Jan 18 '16 at 23:19
  • thanks everyone. this was a duplicate and the timeout answer was what worked. – random-forest-cat Jan 19 '16 at 01:14

0 Answers0