Toggle get not working

I am using code from toggle example,

label class=“toggle toggle-init color-red”>
input type=“checkbox” checked>
span class=“toggle-icon”>

but this
return undefined.


If it returns undefined then you call it when toggle element is not in DOM. Make sure you are calling it when it is presented in DOM

I put it in PageInit. What is correct place?

After being stuck on this for a while I realized you have to create it in pageInit.

var toggle = app.toggle.create({
el: ‘.toggle’
on: {
change: function () {
console.log(‘Toggle changed’)

then you can do toggle.toggle() ect.

I could not get toggle.get() to work