checked

The checked() method, called without any parameters, will return the current checked state of a Switch element.

The checked(bool) method is used to update a Switch checked state. Passing true will check it and false will set the widget as unchecked.

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

<script type="text/javascript">
    $(function () {
        $("#switch").shieldSwitch({
            // set initially as unchecked
            checked: false
        });

        // will print false
        console.log($("#switch").swidget().checked());

        // set as checked
        $("#switch").swidget().checked(true);

        // will print true
        console.log($("#switch").swidget().checked());
    });
</script>