Microsoft KB Archive/231321

= INFO: Text Selection in a Control Not Cleared on Blur Event =

Article ID: 231321

Article Last Modified on 5/11/2006

-

APPLIES TO


 * Microsoft Internet Explorer 5.0
 * Microsoft Internet Explorer 5.5

-



This article was previously published under Q231321



SUMMARY
Generally it is expected that the selection in a control is cleared when the focus moves to a different control. But Internet Explorer 5.0 does not behave this way, enabling toolbar-like scenarios, such as clicking on the button, to manipulate the selection.



MORE INFORMATION
The following code demonstrates how to clear the text when the focus moves to another control, by setting the control to its own value in the onblur event.

Place the following code in an HTML file and view in Internet Explorer.     



 When setting focus from a text box to a button in Internet Explorer 5, the text that was selected remains selected even though the focus is now on the button. 

 To work around this, set the value of contents of the Text to itself. This can be done by uncommenting code in onblur event of text1. 

 Text1 <INPUT id=text1 name=text1 tabindex=1></P> </P>

 Button <INPUT id=button1 name=button1 type=button value=Button tabindex=2> </P> </BODY> </HTML>

<div class="references_section">