Permalink
Browse files

Trigger the change event when setting the associated id-element input.

  • Loading branch information...
1 parent 4a96561 commit 95fd7cefa6b8c5341ca19e970450c3198ecaafcd @budu committed Dec 20, 2011
Showing with 2 additions and 2 deletions.
  1. +2 −2 lib/assets/javascripts/autocomplete-rails.js
View
4 lib/assets/javascripts/autocomplete-rails.js
@@ -87,7 +87,7 @@ $(document).ready(function(){
} else {
this.value = terms.join("");
if ($(this).attr('data-id-element')) {
- $($(this).attr('data-id-element')).val(ui.item.id);
+ $($(this).attr('data-id-element')).val(ui.item.id).change();
}
if ($(this).attr('data-update-elements')) {
var data = $(this).data(ui.item.id.toString());
@@ -100,7 +100,7 @@ $(document).ready(function(){
var remember_string = this.value;
$(this).bind('keyup.clearId', function(){
if($(this).val().trim() != remember_string.trim()){
- $($(this).attr('data-id-element')).val("");
+ $($(this).attr('data-id-element')).val("").change();
$(this).unbind('keyup.clearId');
}
});

0 comments on commit 95fd7ce

Please sign in to comment.