KendoUI下拉列表

时间:2018-11-09 13:19:36

标签: javascript jquery kendo-ui

如果用户仅在下拉列表中选择第三个值,是否可以调用一个函数(显示div)?

<script>
        $(document).ready(function() {
            var data = [
            {text: "Initial Notification", value:"1"},
            {text: "Update Notification", value:"2"},
            {text: "Final Notification", value:"3"}
            ];
            $("#notificationtype").kendoDropDownList({
                dataTextField: "text",
                dataValueField: "text",
                dataSource: data,
                height: 400
            });

            var dropdownlist = $("#notificationtype").data("kendoDropDownList");
        });
    </script>

1 个答案:

答案 0 :(得分:0)

设法使其成为

 <script>
        $(document).ready(function() {
            var data = [
            {text: "Initial Notification", value:"1"},
            {text: "Update Notification", value:"2"},
            {text: "Final Notification", value:"3"}
            ];
            $("#notificationtype").kendoDropDownList({
                dataTextField: "text",
                dataValueField: "text",
                dataSource: data,
                height: 400,
                change: function() {
                   var notificationstate = $("#notificationtype").val();
                   if (notificationstate == "Final Notification") {
                       $('#finaltime').show();
                   } else{
                       $ ('#finaltime').hide();
                   }
                }
            });
            var dropdownlist = $("#notificationtype").data("kendoDropDownList");
        });
    </script>