Hello,
I have a scenario where the background color of a field is changed based on Text.
The issue I'm having is that it's based on Change.
What I want is that the field has a default value & the color should also reflect in that...
If possible currently the field is single line , but I would like it to be drop down, I can change it to Select.
But the color of the field should reflect as per script...
Here is the code:
$('.ObjectivesTable').on('change','.ObjectivesColor input', function() {
if ($(this).val() == 'Move'){
$(this).css('background-color', 'lightgreen');
}
else if ($(this).val() == 'Ava'){
$(this).css('background-color', 'pink');
}
else if ($(this).val() == 'Ground'){
$(this).css('background-color', 'lightpurple');
}
else {$(this).css('background-color', 'orange');}
});
copied from another answers post.
Please help.
Regards,
Sahil