0

In a Previous thread I was looking for a solution to setting focus to a newly inserted input. This now all works fine but I've noticed some very odd behavior since implementing it and thought that it probably warranted a new thread.

The object itself is added via a POST and after this is done I then use the following code to set the focus on it-

    setInterval(function() {
        $('#autoLook\\[' + (newRow -1) + '\\]').focus(); 
        }, 1 )

This all works great and the new input now has focus set as desired. But if I then try to click on any other input element on the page it will not allow me to select them, even after I've filled out the input box that I've set focus on. Is there an alternative to focus that I can use that doesn't stop me from setting focus on other inputs?

Community
  • 1
  • 1
MorkPork
  • 844
  • 3
  • 20
  • 41
  • 1
    use a timeout, not an interval. BTW, not sure why you need to delay the focus method here – A. Wolff May 08 '14 at 09:51
  • please make that the answer it works a treat! :) – MorkPork May 08 '14 at 09:53
  • You'd have better to explain why you need to delay the focus method – A. Wolff May 08 '14 at 09:55
  • I think that it was because I had a "processing" dialog open while ajax was happening and this was stopping me setting the focus, once I put in a timeout to wait 1 milliseond longer than the "processing" dialog was open for all then works fine – MorkPork May 08 '14 at 10:25

0 Answers0