jquery ui 帮助程序 mvc Select 事件
jquery ui helper mvc Select event
当用户 select 来自 jquery ui 自动完成填充列表时,我正在尝试访问“select”事件我想在 jquery ui 自动完成“Select”事件调用时触发一个事件。
我的问题是
我正在使用 JqueryUiHelper MVC,但不知道如何使用 htmlHelper http://jqueryuihelpers.apphb.com/Docmo/Autocomplete
使用 select 事件
@using JQueryUIHelpers
@Html.JQueryUI().AutocompleteFor(x => x.SearchText, Url.Action("SearchFilter"), new { @class = "form-control", placeholder = "Company name here for search..", style = "max-width:none;" }
)
@section Styles {
@Styles.Render("~/Content/jqueryui")
}
@section Scripts {
@Scripts.Render("~/bundles/jqueryui")
}
如有任何帮助,我们将不胜感激。
我的解决方案来自 https://api.jqueryui.com/autocomplete/#event-select
将事件侦听器绑定到自动完成选择事件:
$(function () {
$("#SearchText").on("autocompleteselect", function (event, ui) {
event.preventDefault();
$(this).val(ui.item.value);
$('#btnGo').click();
});
});
当用户 select 来自 jquery ui 自动完成填充列表时,我正在尝试访问“select”事件我想在 jquery ui 自动完成“Select”事件调用时触发一个事件。
我的问题是
我正在使用 JqueryUiHelper MVC,但不知道如何使用 htmlHelper http://jqueryuihelpers.apphb.com/Docmo/Autocomplete
@using JQueryUIHelpers
@Html.JQueryUI().AutocompleteFor(x => x.SearchText, Url.Action("SearchFilter"), new { @class = "form-control", placeholder = "Company name here for search..", style = "max-width:none;" }
)
@section Styles {
@Styles.Render("~/Content/jqueryui")
}
@section Scripts {
@Scripts.Render("~/bundles/jqueryui")
}
如有任何帮助,我们将不胜感激。
我的解决方案来自 https://api.jqueryui.com/autocomplete/#event-select
将事件侦听器绑定到自动完成选择事件:
$(function () {
$("#SearchText").on("autocompleteselect", function (event, ui) {
event.preventDefault();
$(this).val(ui.item.value);
$('#btnGo').click();
});
});