Sometimes before I faced a issue the jQuery focus not working in Chrome and in Mozilla It was working fine. I have google the issue and came up with a solution. Same solution I am explaining here so that It can be useful for developers.
I have an input box and after submitting the data input in this element and trying to focus on it eg
It doesn’t work, no error is thrown but the element isn’t focused.
It seems bug in chrome. Sometimes it is too fast to execute events properly. So I have got the solution of this issue by doing some delay using setTimeout() as follows :
and this code works fine, using
setTimeout() with a minimal delay. It will slow down Chrome and make it work.