Hello, Massimiliano All you need to do is store the selection coordinates on the dialog open, then restore them on action. The easiest way to handle this is using my DocumentSelection library: http://svn.debugger.ru/repos/jslibs/BrowserExtensions/trunk/documentselection.js It successfully tracks all the oddities of the Internet Explorer. If you'd like to extract only the selection calculation code, search for the "-100000000" substring and take the whole function from there. -- With the best regards, Ilya Lebedev mailto:ilya@xxxxxxxxxxx Friday, March 6, 2009, 2:34:52 PM you wrote: MB> I try to finish these plugins MB> http://maxb.net/blog/2009/02/26/dokuwiki-jquery-ui-autocomplete/ MB> I want to use jQuery UI Dialog to write a link (internal & MB> external) and put the value in the textarea. MB> But I found a big problem. MB> When the focus goes in another form field Internet explorer 6 looses "caret". MB> I tested this MB> alert(document.selection. MB> createRange().text); MB> if I select something in the textarea, open the dialog window MB> (jQUERY UI not popup) and press the button "ok", alert return the selection in then textarea. MB> if I select something in the textarea, open the dialog window MB> (jQUERY UI not popup) then write something in the input field of MB> the Dialog and at least press "ok" the alert return an empty MB> value (loosing the value of the selection). MB> The problem causes the insert of the value at the top of textarea. MB> So, if is not possible to solve the problem, MB> ... I leave this solution jQuery based and make the same thing with a classic popup. MB> I will do as you do with mediamanager. MB> Thanks for help. MB> Max MB> PS: sorry for my english -- DokuWiki mailing list - more info at http://wiki.splitbrain.org/wiki:mailinglist