1
I am modifying inputs checkbox
hiding them and calling labels
to receive the function of checked
.
As you can see in FIDDLE and also in the codes shown below, when clicking in ascending order, the effect is assigned all the checkeds
that are next to the clicked.
However, what I could observe sending $_POST
of the form, is that however much of the effect CSS
has been assigned, inputs do not become checkeds
, then it is a logical error in CSS
.
How to leave the effects of
label
and remove this error from css code logic?
.hidden { display:none }
#checkboxes input[type="checkbox"].drm ~ label {
float: left;
cursor: pointer;
vertical-align: middle;
margin: 0px 2px 0px 8px;
width: 37px;
line-height: 37px;
text-align: center;
border: 1px #898989 solid;
background-color: #FFF;
color: #3F3F41;
font-size: 13px;
text-transform: uppercase;
}
#checkboxes input[type="checkbox"].drm ~ label:hover {
border:1px #052245 solid;
background-color:#052245;
color:#FFF;
}
#checkboxes input[type="checkbox"]:checked.drm ~ label {
border:1px #052245 solid;
background-color:#052245;
color:#FFF;
}
<div id="checkboxes" class="checkboxes ajuste-checkboxes floatright">
<input id="dorm1" class="hidden drm" type="checkbox" name="dorms[]" value="1">
<label for="dorm1" class="montserrat fs-16">1</label>
<input id="dorm2" class="hidden drm" type="checkbox" name="dorms[]" value="2">
<label for="dorm2" class="montserrat fs-16">2</label>
<input id="dorm3" class="hidden drm" type="checkbox" name="dorms[]" value="3+">
<label for="dorm3" class="montserrat fs-16">3+</label>
</div>
As soon as I click on number 1, it keeps dialing all. I need you to mark only what I clicked. I went to the FIDDLE who sent me and it doesn’t seem to be working.
– Marcos Vinicius
Thanks for the help ... I await feedback from the operation ...
– Marcos Vinicius
Sorry, I understood that you wanted to cascade them checked, updated the Fiddler, but with the tip from Bacco, which is the correct.
– RBoschini