Jquery select 事件上的自动完成组合框。 asp。净MVC 5

Jquery autocomplete-combobox on select Event. asp. net mvc 5

我的视图中有多个自动完成组合框:

        @Html.LabelFor(model => model.foo)
        @Html.DropDownListFor(model => model.foo, Model.ColaboradoresSelectListItem, "--- Select One Item---", new { @class = "autocomplete-combobox" @id = "foo"})
        @Html.ValidationMessageFor(model => model.foo, String.Empty)

        @Html.LabelFor(model => model.foo2)
        @Html.DropDownListFor(model => model.foo2, Model.ColaboradoresSelectListItem, "--- Select One Item---", new { @class = "autocomplete-combobox" @id = "foo2" })
        @Html.ValidationMessageFor(model => model.foo, String.Empty)

我需要 select 一个项目,之后我只需要开始一个活动,到目前为止我已经尝试过了:

    $("#foo").autocomplete({
        select: function (event, ui) { }
    });

    $("#foo").on("autocompleteselect", function (event, ui) {
        alert("Tell me, tell me, tell me now!!!");
    });

    $("#aeroportos").change(function() {
        //$.getJSON("/Home/States/List/" + $("#Countries > option:selected").attr("value"), function (data) {
        //    var items = "<option>---------------------</option>";
        //    $.each(data, function (i, state) {
        //        items += "<option value='" + state.Value + "'>" + state.Text + "</option>";
        //    });
        //    $("#States").html(items);
        //});
        alert("Tried that too");
    });

有什么建议吗?

试试这个。 http://jsfiddle.net/andrewwhitaker/hAM9H/

select: function( event, ui ) {
ui.item.option.selected = true;
self._trigger( "selected", event, {
    item: ui.item.option
});
select.trigger("change");                            

},

然后

$(".cmbBox").change(function() {
alert(this.value);});