id	summary	reporter	owner	description	type	status	priority	milestone	component	version	resolution	keywords	cc	blocking	blockedby
6858	handling for cursor position	g3n3r1c		"We recently got the problem, that IE8 will set cursor position to end in autocomplete input field after click on data item. (UI 1.8.7) and it is not possible to see the begin of text.
[[BR]]
So we wrote a function to set cursor position to start after clicked on data item.

----

{{{
new function(jQuery) {
  jQuery.fn.setCursorPosition = function(pos) {
    if (jQuery(this).get(0).setSelectionRange) {
      jQuery(this).get(0).setSelectionRange(pos, pos);
    } else if (jQuery(this).get(0).createTextRange) {
      var range = jQuery(this).get(0).createTextRange();
      range.collapse(true);
      range.moveEnd('character', pos);
      range.moveStart('character', pos);
      range.select();
    }
  }
}(jQuery);

to use with autocomplete:
 select: function(event, ui) {
                    jQuery(""pam"").val(ui.item.iata);

  /* IE8 set cursor position to begin when click data item */
                    jQuery(""pam"").focus(function() {
                      jQuery(this).setCursorPosition(0);
                    });

                }

}}}

----


The problem is: Some need it at the end, some need it at begin.

To Solve: Write an boolean option f.ex. 'cursorToStart: true,' that sets the cursor to begin of input or if false to the end.


{{{
jQuery(""#acBox"").autocomplete({
                source : ""url/acsearch"",
              minLength: 2,
                   html: true,
                  delay: 1,
          cursorToStart: true
}}}
"	bug	closed	minor	1.9.0	ui.autocomplete	1.8.7	notabug				
