Skip to content

Commit

Permalink
Add <option /> with selected attribute
Browse files Browse the repository at this point in the history
Add <option /> with selected attribute instead of selecting it
afterwards with JS
  • Loading branch information
koenpunt committed Nov 22, 2011
1 parent 0b3aaf3 commit 08068f1
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 24 deletions.
12 changes: 2 additions & 10 deletions chosen/chosen.jquery.js
Expand Up @@ -586,7 +586,6 @@
};
Chosen.prototype.search_results_mouseup = function(evt) {
var target;
return false;
target = $(evt.target).hasClass("active-result") ? $(evt.target) : $(evt.target).parents(".active-result").first();
if (target.length) {
this.result_highlight = target;
Expand Down Expand Up @@ -827,17 +826,10 @@
};
Chosen.prototype.select_append_option = function(options) {
var option;
option = $('<option />', options);
option = $('<option />', options).attr('selected', 'selected');
this.form_field_jq.append(option);
this.form_field_jq.trigger("liszt:updated");
return setTimeout((__bind(function() {
this.input_focus();
return setTimeout((__bind(function() {
this.search_field.val(options.text);
this.search_field.trigger("keyup");
return this.result_select();
}, this)), 10);
}, this)), 10);
return this.search_field.trigger('focus');
};
Chosen.prototype.no_results_clear = function() {
return this.search_results.find(".no-results").remove();
Expand Down

0 comments on commit 08068f1

Please sign in to comment.