Autofocus not working in ie11

when i put one div tag then i set autofocus on that div after that when i press the button then focus not going on that div.in mozilla and chrom all are  working fine
bharath kuamr ReddyDOT NET DEVELOPERAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

hieloCommented:
try giving it a tabindex attribute:
<div tabindex="-1">...</div>

Open in new window


Also, if you are calling focus() dynamically, try calling it from within a setTimeout() -ex:
setTimeout( function(){  element.focus(); },10);

Open in new window


where element is a node reference to the div in question
bharath kuamr ReddyDOT NET DEVELOPERAuthor Commented:
Not working  in IE
Dave BaldwinFixer of ProblemsCommented:
Show us some code that demonstrates the problem.
Determine the Perfect Price for Your IT Services

Do you wonder if your IT business is truly profitable or if you should raise your prices? Learn how to calculate your overhead burden with our free interactive tool and use it to determine the right price for your IT services. Download your free eBook now!

bharath kuamr ReddyDOT NET DEVELOPERAuthor Commented:
when i put one div tag then i set autofocus on that div after that when i press the button then focus not going on that div.in mozilla and chrom all are  working fine

MyCode
--------------------------------------------------------------------------------------------------
<div id="error_msg" class="error_text margin_px"></div>

in my Js file
----------------------------------------------------------------------------------------------------
   var element = document.getElementById("error_msg");
                setTimeout(function () { element.focus(); }, 10);
----------------------------------------------------------------------------------------------

The above code not working in IE when i click button focus is not going to that div
Dave BaldwinFixer of ProblemsCommented:
That's really not enough.  I can't make a test page out of that that will do anything in Firefox.  With just that, you can't even tell if the 'focus' has moved to the 'div'.
bharath kuamr ReddyDOT NET DEVELOPERAuthor Commented:
Then Please let me know How can i do that one.I am getting this last issue last two days.
Dave BaldwinFixer of ProblemsCommented:
hieloCommented:
Try:
var element = document.getElementById("error_msg");
element.setAttribute('tabindex',-1);
setTimeout(function () { element.focus(); }, 100);

Open in new window

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
HTML

From novice to tech pro — start learning today.