Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Use Kendo UI switch in a web application

I am trying to use a Kendo mobile widget - switch in my web application as below:

enter image description here

<input id="btnConvert" type="checkbox" onclick="onChange();" />

 $(document).ready()
    {        
        $("#btnConvert").kendoMobileSwitch({
            onLabel: "UK",
            offLabel: "US"
        });        
    }
    function onChange(e) {
        alert(e.checked);//true of false
    }

But its not firing the click event. i tried the onchange event which is also not working.

Also i tried

    $('input:checkbox').change(function () {
}

but no success...

like image 784
sony Avatar asked Jul 28 '14 16:07

sony


1 Answers

Define a change handler event in your switch definition.

$("#btnConvert").kendoMobileSwitch({
    onLabel: "UK",
    offLabel: "US",
    change : function (e) {
        alert("You changed the value");
    }
}); 

See the documentation here.

like image 106
OnaBai Avatar answered Oct 21 '22 18:10

OnaBai