Note that there are some explanatory texts on larger screens.

plurals
  1. POCSS 3 checkbox value is null when set to "off"
    primarykey
    data
    text
    <p>I have the following checkbox:</p> <pre><code>&lt;div class="onoffswitch"&gt; &lt;input type="checkbox" name="showOnNavigation" class="onoffswitch-checkbox" id="showOnNavigation" checked&gt; &lt;label class="onoffswitch-label" for="showOnNavigation"&gt; &lt;div class="onoffswitch-inner"&gt;&lt;/div&gt; &lt;div class="onoffswitch-switch"&gt;&lt;/div&gt; &lt;/label&gt; &lt;/div&gt; </code></pre> <p>The CSS for it:</p> <pre><code>.onoffswitch { position: relative; width: 90px; -webkit-user-select:none; -moz-user-select:none; -ms-user-select: none; } .onoffswitch-checkbox { display: none; } .onoffswitch-label { display: block; overflow: hidden; cursor: pointer; border: 2px solid #999999; border-radius: 20px; } .onoffswitch-inner { width: 200%; margin-left: -100%; -moz-transition: margin 0.3s ease-in 0s; -webkit-transition: margin 0.3s ease-in 0s; -o-transition: margin 0.3s ease-in 0s; transition: margin 0.3s ease-in 0s; } .onoffswitch-inner:before, .onoffswitch-inner:after { float: left; width: 50%; height: 30px; padding: 0; line-height: 30px; font-size: 14px; color: white; font-family: Trebuchet, Arial, sans-serif; font-weight: bold; -moz-box-sizing: border-box; -webkit-box-sizing: border-box; box-sizing: border-box; } .onoffswitch-inner:before { content: "ON"; padding-left: 10px; background-color: #A3D900; color: #FFFFFF; } .onoffswitch-inner:after { content: "OFF"; padding-right: 10px; background-color: #CCCCCC; color: #333333; text-align: right; } .onoffswitch-switch { width: 25px; margin: 2.5px; background: #000000; border: 2px solid #999999; border-radius: 20px; position: absolute; top: 0; bottom: 0; right: 56px; -moz-transition: all 0.3s ease-in 0s; -webkit-transition: all 0.3s ease-in 0s; -o-transition: all 0.3s ease-in 0s; transition: all 0.3s ease-in 0s; } .onoffswitch-checkbox:checked + .onoffswitch-label .onoffswitch-inner { margin-left: 0; } .onoffswitch-checkbox:checked + .onoffswitch-label .onoffswitch-switch { right: 0px; } </code></pre> <p>When I'm submitting a form and checkbox is on the ON position, the checkbox value is ON. When it is on OFF position, the value is not set to OFF, so my script will issue an error that the index is not set. It used to work before, but for some reason it doesn't work anymore. Really frustrating, kindly HELP!! A CSS only approach would be most preffered, otherwsie I could easily do this with JavaScript.</p> <p>I got the code generated from <a href="http://proto.io/freebies/onoff/" rel="nofollow">http://proto.io/freebies/onoff/</a></p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload