New to Kendo UI for jQuery? Download free 30-day trial

Checked Switch

The checked state of the Switch depends on the checked configuration option or the checked attribute of the widget element.

The following example demonstrates how to initialize the Switch from a checked input.

<input type="checkbox" id="switch" checked="checked" />

<script>
    var switchInstance = $("#switch").kendoSwitch();
</script>

The following example demonstrates how to initialize a checked Switch by using the jQuery plugin syntax.

<input type="checkbox" id="switch" />

<script>
    var switchInstance = $("#switch").kendoSwitch({
            checked: true
        });
</script>

The following example demonstrates how to get or set the Switch checked state.

<input id="switch" />

<script>
    var switchInstance = $("#switch").kendoSwitch().data("kendoSwitch");
    //get the Switch checked state
    console.log("Is Swicth checked?: " + switchInstance.check());

    //set the Switch checked state
    switchInstance.check(true);

    //get the Switch checked state
    console.log("Is Swicth checked?: " + switchInstance.check());
</script>

See Also

In this article