Skip to content

Commit

Permalink
Fix 'remove-valueless-option' + Input type=text + Remove minified (ou…
Browse files Browse the repository at this point in the history
…t of sync)
  • Loading branch information
jamieholst committed Aug 12, 2014
1 parent efc0591 commit 6321741
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 31 deletions.
2 changes: 1 addition & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<title>Select to Autocomplete</title>
<script src="jquery.js"></script>
<script src="jquery-ui-autocomplete.js"></script>
<script src="jquery.select-to-autocomplete.min.js"></script>
<script src="jquery.select-to-autocomplete.js"></script>
<script type="text/javascript" charset="utf-8">
(function($){
$(function(){
Expand Down
16 changes: 12 additions & 4 deletions jquery.select-to-autocomplete.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
Version: 1.0.5
Version: 1.0.6
Documentation: http://baymard.com/labs/country-selector#documentation
Expand Down Expand Up @@ -39,13 +39,17 @@ THE SOFTWARE.
'relevancy-sorting-strict-match-value': 5,
'relevancy-sorting-booster-attr': 'data-relevancy-booster',
handle_invalid_input: function( context ) {
context.$text_field.val( context.$select_field.find('option:selected:first').text() );
var selected_finder = 'option:selected:first';
if ( context.settings['remove-valueless-options'] ) {
selected_finder = 'option:selected[value!=]:first';
}
context.$text_field.val( context.$select_field.find( selected_finder ).text() );
},
handle_select_field: function( $select_field ) {
return $select_field.hide();
},
insert_text_field: function( context ) {
var $text_field = $( "<input></input>" );
var $text_field = $( '<input type="text"></input>' );
if ( settings['copy-attributes-to-text-field'] ) {
var attrs = {};
var raw_attrs = context.$select_field[0].attributes;
Expand All @@ -70,7 +74,11 @@ THE SOFTWARE.
this.select();
});
}
return $text_field.val( context.$select_field.find('option:selected:first').text() )
var selected_finder = 'option:selected:first';
if ( context.settings['remove-valueless-options'] ) {
selected_finder = 'option:selected[value!=]:first';
}
return $text_field.val( context.$select_field.find( selected_finder ).text() )
.insertAfter( context.$select_field );
},
extract_options: function( $select_field ) {
Expand Down
26 changes: 0 additions & 26 deletions jquery.select-to-autocomplete.min.js

This file was deleted.

0 comments on commit 6321741

Please sign in to comment.