github github
  • Home
  • Pricing and Signup
  • Training
  • Gist
  • Blog
  • Login

jquery / jquery-ui

  • Admin
  • Watch Unwatch
  • Fork
  • Your Fork
  • Pull Request
  • Download Source
    • 921
    • 212
  • Source
  • Commits
  • Network (212)
  • Graphs
  • Tree: 53489b5

click here to add a description

click here to add a homepage

  • Switch Branches (8)
    • bind
    • devpreview
    • formcontrols
    • master
    • menu
    • panel
    • tooltip
    • widget-super
  • Switch Tags (21)
    • 1.9m2
    • 1.9m1
    • 1.8rc3
    • 1.8rc2
    • 1.8rc1
    • 1.8b1
    • 1.8a2
    • 1.8a1
    • 1.8.4
    • 1.8.3
    • 1.8.2
    • 1.8.1
    • 1.8
    • 1.7
    • 1.6rc6
    • 1.6rc5
    • 1.6rc3
    • 1.6rc2
    • 1.6
    • 1.5.2
    • 1.5.1
  • Comments
  • Contributors
Sending Request…

The official jQuery user interface library. — Read more

  Cancel

http://jqueryui.com/

  Cancel
  • HTTP
  • Git Read-Only

This URL has Read+Write access

Autocomplete: Don't update the value of the text field until after setting focus. Fixes #5639 - Cursor jumps to beginning on select.
scottgonzalez (author)
Mon Jul 19 11:36:40 -0700 2010
commit  53489b502dc51edb7707
tree    a605353f51e9a02fb59b
parent  5e3755af8aa17b2bf742
M ui/jquery.ui.autocomplete.js 10 •••••
Txt ui/jquery.ui.autocomplete.js
  • View file @ 53489b5
... ...
@@ -132,9 +132,12 @@ $.widget( "ui.autocomplete", {
132 132
           }
133 133
         },
134 134
         selected: function( event, ui ) {
135  
-          var item = ui.item.data( "item.autocomplete" );
  135
+          var item = ui.item.data( "item.autocomplete" ),
  136
+            setValue = false;
136 137
           if ( false !== self._trigger( "select", event, { item: item } ) ) {
137  
-            self.element.val( item.value );
  138
+            // #5639 - if we set the value before setting focus
  139
+            // the cursor will move to the beginning of the field in IE
  140
+            setValue = true;
138 141
           }
139 142
           self.close( event );
140 143
           // only trigger when focus was lost (click on menu)
... ...
@@ -144,6 +147,9 @@ $.widget( "ui.autocomplete", {
144 147
             self.previous = previous;
145 148
           }
146 149
           self.selectedItem = item;
  150
+          if ( setValue ) {
  151
+            self.element.val( item.value );
  152
+          }
147 153
         },
148 154
         blur: function( event, ui ) {
149 155
           if ( self.menu.element.is(":visible") ) {

0 notes on commit 53489b5

Please log in to comment.
Dedicated Server Powered by the Dedicated Servers and
Cloud Computing of Rackspace Hosting®
  • Blog
  • Support
  • Training
  • Job Board
  • Shop
  • Contact
  • API
  • Status
  • © 2010 GitHub Inc. All rights reserved.
  • Terms of Service
  • Privacy
  • Security
  • English
  • Deutsch
  • Français
  • 日本語
  • Português (BR)
  • 中文
  • See all available languages

Your current locale selection: English. Choose another?

  • English
  • Afrikaans
  • Català
  • Čeština
  • Deutsch
  • Español
  • Français
  • Hrvatski
  • Indonesia
  • Italiano
  • 日本語
  • Nederlands
  • Norsk
  • Polski
  • Português (BR)
  • Српски
  • Svenska
  • 中文