New to Kendo UI for jQueryStart a free 30-day trial

Getting Started with the ListBox

This guide demonstrates how to get up and running with the Kendo UI for jQuery ListBox.

After the completion of this guide, you will be able to achieve the following end result:

Loading ...

1. Create a Select Element

First, create a select element on the page from which the ListBox will be initialized.

html
<select id="listBox"></select>

2. Initialize the ListBox

In this step, you will initialize the ListBox from the <select> element. All settings of the ListBox will be provided in the initialization script statement and you have to describe its layout and configuration in JavaScript.

html
<select id="listBox"></select>

<script>
    // Target the select element by using jQuery and then call the kendoListBox() method.
    $("#listBox").kendoListBox();
</script>

3. Bind the ListBox to Data

Once the basic initialization is completed, you can start adding additional configurations to the ListBox. The first and most important configuration is the dataSource.

html
<select id="listBox"></select>

<script>
      $("#listBox").kendoListBox({
        dataTextField:"text",
        dataValueField:"value",
        dataSource: [ 
          { text: "Item 1", value: 1 },
          { text: "Item 2", value: 2 },
          { text: "Item 3", value: 3 },
          { text: "Item 4", value: 4 },
        ]
      });
    </script>

4. Configure the ListBox Toolbar

By default, the ListBox toolbar isn't rendered. To display the toolbar with arrow buttons that allow the user to change the position of the items, configure the tools option.

html
<select id="listBox"></select>

<script>
      $("#listBox").kendoListBox({
        dataTextField:"text",
        dataValueField:"value",
        dataSource: [ 
          { text: "Item 1", value: 1 },
          { text: "Item 2", value: 2 },
          { text: "Item 3", value: 3 },
          { text: "Item 4", value: 4 },
        ],
        toolbar:{
            tools: ["moveUp", "moveDown"]
        }
      });
    </script>

Next Steps

See Also