8
I have a virtual store in which it generates the following HTML of a select
that has image inside it. I would like to hide the input
(select radio ball) and display only one border in the selected image that will match the select
selected.
Important
The input
radio will be generated automatically in the store with a html
identical to this, the difference will be that in each product the name of the input
will be different, in these my examples have the names option[238]
and option[239]
. But the store will generate more, as option[240]
, option[241]
...
An answer below @Matthew Veloso helped me if in my code there was only one input radio
with your options. But my case will have more than input radio
. With that his solution leaves only the last input radio
marked with the edge and the others inputs
with its appropriate options is not visible what was the user’s choice. See here the demonstration.
The input
will be single selection, but will have more than one inpupt radio
each with its options and only one of them can be marked. Example, there is the input radio
"Insole Color" with their respective colors (only one of them can be marked), then has "Solado Color" with their respective colors and so on. The fact is that they will not have a name defined, they will be generated automatically. In the example link I put, the "Insole Color" has name="option[238]"
but may have another name.
Here you can see the code working:
#product .radio {
display: inline-block;
margin-right:10px;
}
.radio {
position: relative;
display: block;
margin-top: 10px;
margin-bottom: 10px;
}
.radio input[type=radio] {
position: absolute;
margin-top: 4px\9;
margin-left: -20px;
}
#product .radio label {
display: block;
background: none;
color: #111111;
text-align: center;
border: none;
padding: 0;
font-size:0;
}
#product .radio label input {
margin-left: 15px;
}
<div id="product">
<div class="form-group required">
<label class="control-label">Cor Palmilha</label>
<div id="input-option238">
<div class="radio">
<label>
<input type="radio" name="option[238]" value="56">
<img src="https://s19.postimg.org/krdm2veer/cor-produto-cinza.jpg" alt="Cinza" class="img-thumbnail">
</label>
</div>
<div class="radio">
<label>
<input type="radio" name="option[238]" value="55">
<img src="https://s19.postimg.org/da4ennovn/cor-produto-verde.jpg" alt="Verde" class="img-thumbnail">
</label>
</div>
</div>
</div>
<div class="form-group required">
<label class="control-label">Cor Solado</label>
<div id="input-option239">
<div class="radio">
<label>
<input type="radio" name="option[239]" value="66">
<img src="https://s19.postimg.org/krdm2veer/cor-produto-cinza.jpg" alt="Cinza" class="img-thumbnail">
</label>
</div>
<div class="radio">
<label>
<input type="radio" name="option[239]" value="67">
<img src="https://s19.postimg.org/da4ennovn/cor-produto-verde.jpg" alt="Verde" class="img-thumbnail">
</label>
</div>
</div>
</div>
</div>
and when selecting the dark color which would be the color of the border?
– user60252
The color of the border would be the same independent of the selection.
– Wendell
Okay, let me get this straight. There will be more than one input to be checked, is that it? If I want to select 5 colors I have to be able to do this. I’m sure?
– Bsalvo
No, they will be unique selection, but will have more than one
inpupt radio
each with its options and only one of them can be marked. Example, there is theinput radio
"Insole Color" with their respective colors (only one of them can be marked), then has "Solado Color" with their respective colors and so on. The fact is that they will not have a name defined, they will be generated automatically. In the example link I put, the "Insole Color" hasname="option[238]"
but may have another name.– Wendell
Is there not the possibility of changing the HTML format of the code? I was able to solve it in a very simple way only with css. :/
– Paulo Martins
@Paulomartins post your answer then, so I see if you have any adaptation to the store structure.
– Wendell