# Disable DropDownList Items for Selection

## Environment

<table>
 <tr>
  <td>Product</td>
  <td>Progress® Kendo UI® DropDownList for jQuery</td>
 </tr>
 <tr>
  <td>Operating System</td>
  <td>Windows 10 64bit</td>
 </tr>
 <tr>
  <td>Visual Studio Version</td>
  <td>Visual Studio 2017</td>
 </tr>
 <tr>
  <td>Preferred Language</td>
  <td>JavaScript</td>
 </tr>
</table>

## Description

How can I display list items in the Kendo UI for jQuery DropDownList as inactive?

## Solution

A possible approach to make items appear as disabled is to apply the `k-disabled` CSS class in a Kendo UI Template.

To prevent the future selection of disabled items, add an event handler to the [`select`](https://www.telerik.com/kendo-jquery-ui/documentation/api/ui/dropdownlist/events/select) event and call `e.preventDefault()`.

```dojo
    <input id="dropdownlist" /> <button class="k-button"> Mark Oranges as deleted</button>
    <script id="template" type="text/x-kendo-template">
    <span class="#: isDeleted ? 'k-disabled': ''#">
       #: name #
    </span>
    </script>
    <script>
      $("#dropdownlist").kendoDropDownList({
        dataSource: [
          { id: 1, name: "Apples", isDeleted: false},
          { id: 3, name: "Mangoes", isDeleted: false},
          { id: 2, name: "Oranges" , isDeleted: false}
        ],
        dataTextField: "name",
        dataValueField: "id",
        select: function(e){
          if(e.dataItem.isDeleted){
            e.preventDefault();
          }
        },
        template: kendo.template($("#template").html())
      });

      $(".k-button").click(function(){
        var dropdown = $("#dropdownlist").data("kendoDropDownList");
        var oranges = dropdown.dataSource.get(2);
        oranges.set("isDeleted", true);
      })
    </script>
```

## See Also

* [JavaScript API Reference of the DropDownList](https://www.telerik.com/kendo-jquery-ui/documentation/api/ui/dropdownlist)
* [Automatically Adjust the Width of a DropDownList](https://www.telerik.com/kendo-jquery-ui/documentation/knowledge-base/auto-adjust-the-width)
* [Create DropDownLists with Long Items](https://www.telerik.com/kendo-jquery-ui/documentation/knowledge-base/create-dropdownlist-with-long-items)
* [Detect Wrapper Focus Events](https://www.telerik.com/kendo-jquery-ui/documentation/knowledge-base/detect-wrapper-focus-event)
* [Move the Group Label on Top of Items](https://www.telerik.com/kendo-jquery-ui/documentation/knowledge-base/group-label-on-top-of-the-items)
* [Prevent Popup Closure on Scroll](https://www.telerik.com/kendo-jquery-ui/documentation/knowledge-base/prevent-close-on-scroll)
* [Remove Items](https://www.telerik.com/kendo-jquery-ui/documentation/knowledge-base/remove-items)
* [Set DataSource Dynamically](https://www.telerik.com/kendo-jquery-ui/documentation/knowledge-base/set-datasource-dynamically)
* [Update MVVM Bound Models on Load](https://www.telerik.com/kendo-jquery-ui/documentation/knowledge-base/update-model-on-load)
