Menu icon Foundation
Switch buttons - On as default

Hi I would like to know how can I make make checkbox button on as default, using foundation 6 switch button:

<fieldset tabindex="0" class="switch round">
<input id="tpp" class="switch-input" type="checkbox" ng-model="tpp" name="tpp" value="1">
<label for="tpp" class="switch-paddle">
<span class="switch-on">ON</span>
<span class="switch-off">OFF</span>
</label>
</fieldset>

Another, might be a bigger question - how do I get this data? I mean, how do I know if the user picked 'off' or 'on' when submitting a form?

Thanks

switchfoundation 6buttondefaultCheckbox

Hi I would like to know how can I make make checkbox button on as default, using foundation 6 switch button:

<fieldset tabindex="0" class="switch round">
<input id="tpp" class="switch-input" type="checkbox" ng-model="tpp" name="tpp" value="1">
<label for="tpp" class="switch-paddle">
<span class="switch-on">ON</span>
<span class="switch-off">OFF</span>
</label>
</fieldset>

Another, might be a bigger question - how do I get this data? I mean, how do I know if the user picked 'off' or 'on' when submitting a form?

Thanks

This post has been closed. No new replies can be added.

Rafi Benkual almost 3 years ago

Since the switch is a checkbox, you can use the checked attribute to signal it is active or on. There's many ways you can get this value in jQuery. I found this post helpful: http://stackoverflow.com/questions/901712/how-do-i-check-if-a-checkbox-is-checked-in-jquery

Lior Goldstein almost 3 years ago

Hi Rafi!

thank you for your answer.

I managed to find (part of) the problem, but not the solution.

please take another look in here: http://foundation.zurb.com/forum/posts/49798-input-checked-not-working-with-nganimate

 

Lior Goldstein almost 3 years ago

OK. sorry for this. It was a simple issue for Angular.