Skip to content

Commit

Permalink
* Prevent fields from being erased on blur of the search field when d…
Browse files Browse the repository at this point in the history
…ata-update-elements is used.
  • Loading branch information
donv committed Jan 7, 2014
1 parent c4b0e1f commit 25ecf54
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/assets/javascripts/autocomplete-rails-uncompressed.js
Expand Up @@ -69,7 +69,8 @@
});
},
change: function( event, ui ) {
if(jQuery(jQuery(this).attr('data-id-element')).val() == "") {
if(!jQuery(this).is('[data-id-element]') ||
jQuery(jQuery(this).attr('data-id-element')).val() == "") {
return;
}
jQuery(jQuery(this).attr('data-id-element')).val(ui.item ? ui.item.id : "");
Expand Down

0 comments on commit 25ecf54

Please sign in to comment.