I am dynamically creating options for dropdown I want to add diffrent font color on each of option in dropdown. This is working on Google chorome but not on ther browsers.
How to solve this problem
Thanks!!
Here is my code
`<div class="control">
<label for="c_color_id" id="c_color_id_main_label"> Select Color Code </label>
<select name='c_color_id[0]' data-form-part="hairforadmin_formula_form" id="c_color_id_main"
onchange="ColorCodeCurrent(this);">
<?php foreach ($colors as $option) {
if ($option['value'] == '') {?>
<option value=""> Please Add Colors from backend </option>
<?php } else {?>
<option value="<?php echo $option['value'] ?>" style="color:<?php echo $block->getColorFontById($option['value']); ?>"><?php echo $option['label'] ?></option>
<?php }
}?>
</select>
</div>`
I try to search on the internet but didnot find a simple solution that can quickly solve mt problem
2
Answers
Sorry bud, I don’t think it’s possible in other browsers. However you could create a completely custom drop down using CSS and JavaScript, then you can style everything in any way shape or form. I truly hope this helps.
Here is your answer of changing color, back-ground and font size of options in a select list.