Javascript 选中选项时Jquery提交选择表单

Javascript 选中选项时Jquery提交选择表单,javascript,c#,jquery,html,forms,Javascript,C#,Jquery,Html,Forms,我有一个select,有一个很长的列表,我可以用select2jquerypluing在其中搜索它 我的选择: @using (Html.BeginForm("ProjectList", "Client", FormMethod.Get, new { id = "clientform", name = "clientoverviewform"})) { <div class="form-group"> <

我有一个select,有一个很长的列表,我可以用select2jquerypluing在其中搜索它

我的选择:

 @using (Html.BeginForm("ProjectList", "Client", FormMethod.Get, new { id = "clientform", name = "clientoverviewform"}))
        {
            <div class="form-group">
                <label for="sel1">Select Client</label>
                @if (Model.ClientList != null)
                {
                    <select class="form-control selectpicker" data-live-search="true" id="sel1" name="id">

                        @foreach (var client in Model.ClientList)
                        {
                            <option value="@client.Id">@client.Name</option>
                        }

                    </select>
                }
            </div><!-- end form-group-->
            <div class="form-group">
                <input type="submit" value="Vis" class="form-control">
            </div><!-- end form-group-->
        }

在其中,它在我搜索之前提交,但如果我只是正常滚动列表并单击..

则它可以工作。如果您想在更改选择选项后提交表单,请执行以下操作:

$('.selectpicker').on('change', function () {
   $(this).closest('form').submit();
});

如果要在更改“选择”选项后提交表单,请执行以下操作:

$('.selectpicker').on('change', function () {
   $(this).closest('form').submit();
});

不清楚你的问题到底是什么,或者你到底有什么问题。请提供一个例子来说明这个问题(我们不需要您的服务器端代码),我们不清楚您的问题是什么,或者您实际遇到了什么问题。请提供一个例子来说明问题(我们不需要您的服务器端代码)是的当然。。。应该看到。。。只有选择改变了…当然是的。。。应该看到。。。这是唯一改变的选择。。