minhur / bootstrap-toggle

Bootstrap Toggle is a highly flexible Bootstrap plugin that converts checkboxes into toggles
http://www.bootstraptoggle.com
MIT License
1.48k stars 440 forks source link

Added indeterminate state support #197

Open ogeid-dev opened 6 years ago

ogeid-dev commented 6 years ago

I added indeterminate state support, may be a little ugly right now because I had to rush it but it may help someone.

ecttor commented 6 years ago

Hello can you help me with this? I have doubts on how to call the indeterminate state. how should I do this?

ogeid-dev commented 6 years ago

Use the data indeterminate data attribute to enable it like so: <input class="form-control" id="toggle" name="toggle" data-toggle="toggle" data-on="Yes" data-off="No" data-indeterminate="true" type="checkbox">

Then you can set the state like: $('#toggle').prop('indeterminate', true).change();

And check the state with:$("#toggle").prop("indeterminate")

ecttor commented 6 years ago

Ty, your answer helped me a lot.