The script requires jQuery
All works fine but I need to be able to change the color of the selected dropdown when it is selected by the option box, to (bright green). And greyed out again if the other option is chosen.
I have tried all the suggested tips I read up on i.e. $( "#mOptions" ).prop (.css('background-color','#ffffff')); any color. please help and many thanks. Did not work
The script
$(document).ready(function(){
$('input[name="gender"]').click(function() {
if($('input[name="gender"]').is(':checked')) {
var radioValue = $("input[name='gender']:checked").val();
if(radioValue == "m"){
$( "#mOptions" ).prop( "disabled", false );
$( "#fOptions" ).prop( "disabled", true );
} else {
$( "#mOptions" ).prop( "disabled", true );
$( "#fOptions" ).prop( "disabled", false );
}
}
});
});
The Form:
<input type="radio" name="gender" value="m" />Male
<input type="radio" name="gender" value="f" />Female
<br />
<select id="mOptions" disabled="true">
<option>Select</option>
<option value="1">Shirt</option>
<option value="2">Pant</option>
<option value="3">dhoti</option>
</select>
<select id="fOptions" disabled="true">
<option>Select</option>
<option value="4">Saree</option>
<option value="5">Bangle</option>
<option value="6">handbag</option>
</select>