我第一次使用Kendo UI,并且在我的Kendo下拉列表更改中触发某个功能时遇到了一些困难。Kendo UI DropDownList更改为触发事件
我的目标是根据用户的下拉选择显示不同的搜索字段。我尝试了几种不同的方法,似乎没有任何工作。
有没有人有一个简单的jQuery代码片段可以获得Kendo UI下拉菜单的文本?
我的代码如下:
<script>
$(document).ready(function() {
var a = $("div#searchbox span.k-input").text();
console.log(a);
$(a).change(function(){
$('.searchingfor').hide();
$('#' + a).show();
});
});
</script>
@using (Html.BeginForm())
{
<div id="searchbox" class="label">
@Html.Label("Search")
@Html.TextBox("QuickSearch", null, new { style = "width:91%", @class = "k-input" })
<br />
<br />
@(Html.Kendo().DropDownList()
.DataTextField("Text")
.DataValueField("Value")
.BindTo(new List<SelectListItem>()
{
new SelectListItem()
{
Text = "All",
Value = "1"
},
new SelectListItem()
{
Text = "Customer",
Value = "2"
},
new SelectListItem()
{
Text = "Contact",
Value = "3"
},
new SelectListItem()
{
Text = "Service Employee",
Value = "4"
},
new SelectListItem()
{
Text = "Organization",
Value = "5"
},
new SelectListItem()
{
Text = "Employee",
Value = "6"
},
new SelectListItem()
{
Text = "Other",
Value = "7"
}
})
.Name("SearchType")
)
</div>
}