javascript - createTextRange - strange behavior in IE8 -


I have the following problem that has been filed in the text input, which works as an automatic integer for some suggestions It is drying behind it. The problem occurs when you leave the field, the text cursor in IE is located at the end of the suggested string, so you can actually only see its last part. So I used the code to fix it and it works under IE 6, but in IE8 it does not work, the field is always chosen and I can not choose anything on the page.

What is my question, what is the correct way to move the cursor at the beginning of the input field?

 $ ('# myAutocompleter'). Blur (function () {textRange = this.createTextRange (); textRange; collapse (true); textRange.select ();}); 

(The code used is written in jQuery.)

I believe that Are you looking for the .moveStart and .moveEnd methods of the text category:

  $ ('# myAutocompleter'). Blurred (Function () {textRange = this.createTextRange (); textRange.collapse (true); textRange.moveEnd ('character', 0); textRange.moveStart ('character', 0); textRange.select ();} );  

(tested in IE8)


Comments

Popular posts from this blog

asp.net - Javascript/DOM Why is does my form not support submit()? -

sockets - Delphi: TTcpServer, connection reset when reading -

javascript - Classic ASP "ExecuteGlobal" statement acting differently on two servers -