Skip to main content

Search and Top Navigation

#6858 closed bug (notabug)

Opened January 14, 2011 09:32AM UTC

Closed January 14, 2011 01:19PM UTC

handling for cursor position

Reported by: g3n3r1c Owned by:
Priority: minor Milestone: 1.9.0
Component: ui.autocomplete Version: 1.8.7
Keywords: Cc:
Blocked by: Blocking:

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.

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.moveEnd('character', pos);
      range.moveStart('character', pos);;

to use with autocomplete:
 select: function(event, ui) {

  /* IE8 set cursor position to begin when click data item */
                    jQuery("pam").focus(function() {


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.

                source : "url/acsearch",
              minLength: 2,
                   html: true,
                  delay: 1,
          cursorToStart: true
Attachments (0)
Change History (2)

Changed January 14, 2011 09:40AM UTC by g3n3r1c comment:1

It is a opposite of this bug:

Changed January 14, 2011 01:19PM UTC by scottgonzalez comment:2

resolution: → invalid
status: newclosed

This is not a bug, it's a feature request. We also don't want to support this. Feel free to create an extension for this.