Skip to content
Permalink
Browse files

Autocomplete: Update cursor position in multiple demos in IE. Fixes #…

…5761 - Autocomplete: multiple demos need extra IE handling for cursor position
  • Loading branch information...
jzaefferer committed Jun 23, 2010
1 parent 496b408 commit 965dddd9818f7f24ec63666da356248a1c010636
Showing with 14 additions and 0 deletions.
  1. +7 −0 demos/autocomplete/multiple-remote.html
  2. +7 −0 demos/autocomplete/multiple.html
@@ -45,6 +45,13 @@
// add placeholder to get the comma-and-space at the end
terms.push("");
this.value = terms.join(", ");
if ( document.selection ) {
this.focus();
var range = document.selection.createRange();
range.moveStart( 'character', this.value.length );
range.moveEnd( 'character', 0 );
range.select();
}
return false;
}
});
@@ -39,6 +39,13 @@
// add placeholder to get the comma-and-space at the end
terms.push("");
this.value = terms.join(", ");
if ( document.selection ) {
this.focus();
var range = document.selection.createRange();
range.moveStart( 'character', this.value.length );
range.moveEnd( 'character', 0 );
range.select();
}
return false;
}
});

1 comment on commit 965dddd

@Smssyed8

This comment has been minimized.

Copy link

commented on 965dddd May 3, 2018

document.selection is coming undefined for me.
Please let me know if there is any way to set value returned from select function in autocomplete to current cursor position in textarea

Please sign in to comment.
You can’t perform that action at this time.