1
Select:
<div class="span2" class="checks" >
<h4>BRANCO</h4>
<img src= "/images/cor-05.jpg" width="57" height="27">
<input type="checkbox" data-id="TRANSPARENTE" name="cor5" value="BRANCO" />
<label for="lineatura5">Lineatura<span class="required"></span></label>
<select class="span6" name="lineatura5" id="lineatura5" value="">
<option value="">Selecione</option>
<option value="52">52</option>
<option value="42">42</option>
</select>
</div>
Function:
$('select[name="substrato_imprime"]').on('change', function(){
$('.checks').find('input[type="checkbox"]').each(function(){
$(this).prop('checked', false);
});
if($(this).val() !== ''){
$('input[data-id="'+$(this).val()+'"]').prop('checked', true);
}
});
Checkbox:
<input type="checkbox" data-id="TRANSPARENTE" name="cor5" value="BRANCO" />
In a select field above this checkbox, I have 4 options: TRANSPARENT, FROSTED, PEARL AND METALLIZED.
I have a Function that if you choose the option "TRANSPARENT", for example, this checkbox above is marked. But I need the options "FOSCO" and "METALIZED" also happen this marking, if chosen in the select field. There is a way to pass more than one id so that Function does not just make the option "TRANSPARENT"?
PHP is the language.
You want to change the checkbox ID or you want to put more than 1 type ID, TRANSPARENT, FROSTED, METALLIZED?
– Victor Laio
Put more than 1 Victor ID...
– Júlio Ricardo
Enter the code you already have
– JrD
Full code Jrd
– Júlio Ricardo
Why not create input hiddens to do this control? Oh in the item change Js you manipulate these values, cleaning or setting them.
– Victor Laio
I know what you’re talking about, but I can’t perform. I’m a layman yet. I could show you how ?
– Júlio Ricardo
I could, but let me just understand, what is the ultimate purpose of all this??
– Victor Laio
I have four materials to choose from at Select. When "TRANSPARENT", "FROSTED" OR "METALIZED" materials are chosen, the WHITE checkbox should be marked. So my operators will not forget to make the request of this color.
– Júlio Ricardo