diff --git a/README b/README new file mode 100644 index 0000000..d79e550 --- /dev/null +++ b/README @@ -0,0 +1 @@ +Added option allowing automatic input text selection on mouse click. diff --git a/jquery.select-to-autocomplete.js b/jquery.select-to-autocomplete.js old mode 100644 new mode 100755 index b9eea42..600e88e --- a/jquery.select-to-autocomplete.js +++ b/jquery.select-to-autocomplete.js @@ -28,6 +28,7 @@ THE SOFTWARE. 'sort': false, 'sort-attr': 'data-priority', 'sort-desc': false, + 'autoselect': true, 'alternative-spellings': true, 'alternative-spellings-attr': 'data-alternative-spellings', 'remove-valueless-options': true, @@ -63,6 +64,12 @@ THE SOFTWARE. settings['handle_invalid_input'](context); } }); + // give the input box the ability to select all text on mouse click + if ( context.settings['autoselect'] ) { + $text_field.click( function() { + this.select(); + }); + } return $text_field.val( context.$select_field.find('option:selected:first').text() ) .insertAfter( context.$select_field ); },