Get Selected Text and Value from Kendo Dropdownlist on Change Event

  1. <!DOCTYPE html>  
  2. <html>  
  3.   
  4. <head>  
  5.     <meta charset="utf-8">  
  6.     <title>Untitled</title>  
  7.     <link rel="stylesheet" href="http://kendo.cdn.telerik.com/2015.2.805/styles/kendo.common.min.css">  
  8.     <link rel="stylesheet" href="http://kendo.cdn.telerik.com/2015.2.805/styles/kendo.rtl.min.css">  
  9.     <link rel="stylesheet" href="http://kendo.cdn.telerik.com/2015.2.805/styles/kendo.default.min.css">  
  10.     <link rel="stylesheet" href="http://kendo.cdn.telerik.com/2015.2.805/styles/kendo.mobile.all.min.css">  
  11.     <script src="http://code.jquery.com/jquery-1.9.1.min.js"></script>  
  12.     <script src="http://kendo.cdn.telerik.com/2015.2.805/js/angular.min.js"></script>  
  13.     <script src="http://kendo.cdn.telerik.com/2015.2.805/js/jszip.min.js"></script>  
  14.     <script src="http://kendo.cdn.telerik.com/2015.2.805/js/kendo.all.min.js"></script>  
  15. </head>  
  16.   
  17. <body>  
  18.     <div id="example">  
  19.         <div class="demo-section k-header">  
  20.             <h4 class="title">DropDownList</h4>  
  21.             <input id="dropdownlist" style="width: 100%;" />  
  22.         </div>  
  23.         <script>  
  24.             $(document).ready(function() {  
  25.                 function onChange() {  
  26.                     alert($("#dropdownlist").data("kendoDropDownList").text());  
  27.                     alert($("#dropdownlist").val())  
  28.                 };  
  29.                 var data = [{  
  30.                     text: "Item1",  
  31.                     value: "1"  
  32.                 }, {  
  33.                     text: "Item2",  
  34.                     value: "2"  
  35.                 }, {  
  36.                     text: "Item3",  
  37.                     value: "3"  
  38.                 }];  
  39.                 $("#dropdownlist").kendoDropDownList({  
  40.                     dataTextField: "text",  
  41.                     dataValueField: "value",  
  42.                     dataSource: data,  
  43.                     change: onChange,  
  44.                 });  
  45.             });  
  46.         </script>  
  47.     </div>  
  48. </body>  
  49.   
  50. </html>