Q:

Bootstrap-switch state

I'm hoping someone that uses bootstrap-switch can explain this to me.
If I have a bootstrap-switch element, say #test... if I do $('#test').val() then I always get the same result irrespective of the state of the bootstrap-switch?
So I need to somehow call the state of the object, in which case I'll get true or false.
Surely there's a way to use val() to get the selected value - at the end of the day it's just a checkbox. How do I do it though?

A:

I am not user of bootstrap-switch but after going to it's demo page I've noticed that there is an checkbox input. You can read the state by reading checkbox state:
// switch to OFF
$('.bootstrap-switch-container input').prop('checked')
// false

// switch to ON
$('.bootstrap-switch-container input').prop('checked')
// true

