Notice: This website is an unofficial Microsoft Knowledge Base (hereinafter KB) archive and is intended to provide a reliable access to deleted content from Microsoft KB. All KB articles are owned by Microsoft Corporation. Read full disclaimer for more details.

Webpage loses focus when innerHTML replaces DIVs containing INPUT fields


View products that this article applies to.

Symptoms

You have an HTML webpage that contains INPUT fields that are embedded in DIV tags. You use scripting in your webpage and replace the surrounding DIV container by using the innerHTML property. (This property also includes your focused INPUT field.) In this situation, the webpage no longer has the focus.

↑ Back to the top


Cause

This problem occurs because the document.ActiveElement property is set to null.

Note It is the expected behavior in IE9 Standards mode and later modes that the document.ActiveElement property is set to null when you use the innerHTML property to replace the surrounding DIV container.

↑ Back to the top


Resolution

Update information

To resolve this issue, install the most recent cumulative security update for Internet Explorer. To do this, go to Microsoft Update.

For technical information about the most recent cumulative security update for Internet Explorer, go to the following Microsoft website:Note This update was first included in security update 2888505.

For more information, click the following article number to view the article in the Microsoft Knowledge Base:
2888505 MS13-088: Cumulative Security Update for Internet Explorer: November 12, 2013

↑ Back to the top


Workaround

To work around this problem when the content is changed by using the innerHTML property and when the document.ActiveElement is null, set the innerHTML property to the body by calling document.body.setActive(), as appropriate for your situation.

↑ Back to the top


Status

Microsoft has confirmed that this is a problem in the Microsoft products that are listed in the "Applies to" section.

↑ Back to the top


More Information

This update changes the functionality for the legacy IE7 document mode and IE8 document mode (such as in Compatibility View) in Internet Explorer 10 so that the document modes perform the same fallback as they did in earlier Internet Explorer versions:
  • When you use "Internet Explorer 7" document mode, the document.ActiveElement property is set to the BODY tag.
  • When you use the "Internet Explorer 8" document mode, the document.ActiveElement property is set to the HTML tag.

↑ Back to the top


References

See the terminology Microsoft uses to describe software updates.

↑ Back to the top


Keywords: kbnotautohotfix, kbqfe, kbbug, kbfix, kbexpertiseinter, kbsurveynew, kb

↑ Back to the top

Article Info
Article ID : 2905727
Revision : 1
Created on : 1/7/2017
Published on : 11/15/2013
Exists online : False
Views : 275