jQuery DropDown Change Options Dynamically

To change any of the widget options dynamically you need to get the initial options, change the desired properties and call the widget refresh(options) method, passing the new values.
This is demonstrated in the code below:

<select id="ddl" ></select>

<script type="text/javascript">
    dataSource: {
        data: countries
    cls: "myDD",
    textTemplate: "{name}",
    valueTemplate: "{code}"
function changeOptions() {
    var ddl = $("#ddl").swidget(),
    options = ddl.initialOptions;
    options.cls= "testClass";