Dyl*_*uth 0 jquery firebug jquery-chosen drop-down-menu
我正在使用我网站上的Chosen Select Box Jquery插件.select中的选项使用ajax更新,因此当您在1框中选择某些内容时,将显示下一个框的选项.
我几乎让它工作,但当我点击第二个框选项时,第三个框选项不显示.我在FireBug中遇到错误说:
TypeError:item未定义
item.selected = true;
它说它在Chosen Box的js文件中.
JS =======================
Chosen.prototype.result_select = function(evt) {
var high, high_id, item, position;
if (this.result_highlight) {
high = this.result_highlight;
high_id = high.attr("id");
this.result_clear_highlight();
if (this.is_multiple) {
this.result_deactivate(high);
} else {
this.search_results.find(".result-selected").removeClass("result-selected");
this.result_single_selected = high;
this.selected_item.removeClass("chzn-default");
}
high.addClass("result-selected");
position = high_id.substr(high_id.lastIndexOf("_") + 1);
item = this.results_data[position];
item.selected = true; <---------- Error
this.form_field.options[item.options_index].selected = true;
if (this.is_multiple) {
this.choice_build(item);
} else {
this.selected_item.find("span").first().text(item.text);
if (this.allow_single_deselect) this.single_deselect_control_build();
}
if (!(evt.metaKey && this.is_multiple)) this.results_hide();
this.search_field.val("");
if (this.is_multiple || this.form_field_jq.val() !== this.current_value) {
this.form_field_jq.trigger("change", {
'selected': this.form_field.options[item.options_index].value
});
}
this.current_value = this.form_field_jq.val();
return this.search_field_scale();
}
};
Run Code Online (Sandbox Code Playgroud)
我花了好几个小时试图搞清楚但不能.任何帮助,将不胜感激.