Skip to content Skip to sidebar Skip to footer

Jquery Ui Autocomplete Ie Cursor Position Bug

I have just implemented the excellent jQuery UI autocomplete. http://jqueryui.com/demos/autocomplete/ There is a strange bug in IE 8 (and maybe other versions). When you select an

Solution 1:

Try adding the following code into the select event that is passed to the autocomplte function.

So if you have:

jQuery('someval').autocomplete({
        source: availableTags
    });

Change it to be:

jQuery('some_val').autocomplete({
    source: availableTags,

    select : function(event, ui){
            if(document.selection) { 
                this.focus(); 
                var oSel = document.selection.createRange(); 
                oSel.moveStart('character',this.value.length); 
                oSel.moveEnd('character',0); 
                oSel.select(); 
            } 
        }
})

See more: http://forum.jquery.com/topic/ui-autocomplete-multiple-demo-caret-position-in-iehttp://jqueryui.com/demos/autocomplete/#multiple

Solution 2:

http://bugs.jqueryui.com/ticket/6858 This one helped me a lot!

Post a Comment for "Jquery Ui Autocomplete Ie Cursor Position Bug"