Hi Alexander/Telrik -
I would like to know if there is a way to see if the switch is either checked or unchecked?
Basically something like: ON || OFF
if switch.OFF:then run this.function()
If switch.NOT.OFF run that.function();
I had a look at your examples on the demo page but only show a console.log("Checked?Unchecked")
Which toggies with the switch but doesn't allow binding a specific event to the status of a switch.
Thanks in advance.
I would like to know if there is a way to see if the switch is either checked or unchecked?
Basically something like: ON || OFF
if switch.OFF:then run this.function()
If switch.NOT.OFF run that.function();
I had a look at your examples on the demo page but only show a console.log("Checked?Unchecked")
Which toggies with the switch but doesn't allow binding a specific event to the status of a switch.
Thanks in advance.
6 Answers, 1 is accepted
0
Hi Damien,
Switch widget has a check method which allows you to get its state. Also it have a change event that fires when state of the widget changes.
Regards,
Alexander Valchev
the Telerik team
Switch widget has a check method which allows you to get its state. Also it have a change event that fires when state of the widget changes.
Regards,
Alexander Valchev
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0

Gerardo
Top achievements
Rank 1
answered on 13 Jun 2013, 09:10 PM
Hi,
I'm using the documentation you mentioned and I cannot get manage to make it work, I tried it in my current project and it didn't work, I also tried in a blank project with no luck either.
I copy here the documentation of your event, and hope to get an answer soon.
Thanks
<input type="checkbox" id="switch" data-role="switch" />
<script>
$("#switch").data("kendoMobileSwitch").bind("change", function(e) {
console.log(e.checked); // true or false
}
</script>
I'm using the documentation you mentioned and I cannot get manage to make it work, I tried it in my current project and it didn't work, I also tried in a blank project with no luck either.
I copy here the documentation of your event, and hope to get an answer soon.
Thanks
<input type="checkbox" id="switch" data-role="switch" />
<script>
$("#switch").data("kendoMobileSwitch").bind("change", function(e) {
console.log(e.checked); // true or false
}
</script>
0
Hi Gerardo,
I prepared a small example where everything seems to work as expected.
Please compare your implementation with the one presented in the sample.
Regards,
Alexander Valchev
Telerik
I prepared a small example where everything seems to work as expected.
Please compare your implementation with the one presented in the sample.
Regards,
Alexander Valchev
Telerik
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0

Dina
Top achievements
Rank 1
answered on 15 May 2017, 02:14 PM
How to get switch state outside change event?
var myswitch = $("#myswitch ").data("kendoMobileSwitch");
what next?
0
Hi,
You could use the Check() method of the mobile switch component to get the checked state.
http://dojo.telerik.com/@parvanov/AkoXe
Regards,
Misho
Telerik by Progress
You could use the Check() method of the mobile switch component to get the checked state.
http://dojo.telerik.com/@parvanov/AkoXe
Regards,
Misho
Telerik by Progress
Try our brand new, jQuery-free Angular 2 components built from ground-up which
deliver the business app essential building blocks - a grid component,
data visualization (charts) and form elements.
0

John
Top achievements
Rank 2
Iron
Iron
Veteran
answered on 14 Apr 2022, 06:43 PM
the switch updates the internal checkbox as it operates. You could just do something like this (jquery)
$("#switch").prop("checked")