Use jquery Val method and not .value

This commit is contained in:
Patrick Filler 2011-07-13 14:31:59 -04:00
parent 465eb61eb6
commit 56dbefa500
2 changed files with 10 additions and 10 deletions

View file

@ -202,7 +202,7 @@
}
this.container.addClass("chzn-container-active");
this.active_field = true;
this.search_field.value = this.search_field.value;
this.search_field.val(this.search_field.val());
return this.search_field.focus();
};
Chosen.prototype.test_active_click = function(evt) {
@ -338,10 +338,10 @@
};
Chosen.prototype.show_search_field_default = function() {
if (this.is_multiple && this.choices < 1 && !this.active_field) {
this.search_field.value = this.default_text;
this.search_field.val(this.default_text);
return this.search_field.addClass("default");
} else {
this.search_field.value = "";
this.search_field.val("");
return this.search_field.removeClass("default");
}
};
@ -389,7 +389,7 @@
Chosen.prototype.choice_destroy = function(link) {
this.choices -= 1;
this.show_search_field_default();
if (this.is_multiple && this.choices > 0 && this.search_field.value.length < 1) {
if (this.is_multiple && this.choices > 0 && this.search_field.val().length < 1) {
this.results_hide();
}
this.result_deselect(link.attr("rel"));
@ -626,7 +626,7 @@
}
switch (stroke) {
case 8:
return this.backstroke_length = this.search_field.value.length;
return this.backstroke_length = this.search_field.val().length;
case 9:
return this.mouse_on_container = false;
case 13:

View file

@ -179,7 +179,7 @@ class Chosen
@container.addClass "chzn-container-active"
@active_field = true
@search_field.value = @search_field.value
@search_field.val(@search_field.val())
@search_field.focus()
@ -302,10 +302,10 @@ class Chosen
show_search_field_default: ->
if @is_multiple and @choices < 1 and not @active_field
@search_field.value = @default_text
@search_field.val(@default_text)
@search_field.addClass "default"
else
@search_field.value = ""
@search_field.val("")
@search_field.removeClass "default"
search_results_click: (evt) ->
@ -344,7 +344,7 @@ class Chosen
@choices -= 1
this.show_search_field_default()
this.results_hide() if @is_multiple and @choices > 0 and @search_field.value.length < 1
this.results_hide() if @is_multiple and @choices > 0 and @search_field.val().length < 1
this.result_deselect (link.attr "rel")
link.parents('li').first().remove()
@ -545,7 +545,7 @@ class Chosen
switch stroke
when 8
@backstroke_length = this.search_field.value.length
@backstroke_length = this.search_field.val().length
when 9
@mouse_on_container = false
when 13