JavaScript Is it possible to use different colours when the user select one or more options in chosen select? possible different colors

I have a HTML select, and using the Chosen JS plugin, for multiple select.

Chosen uses the CSS property background-image and others to set the style for each select option (always the same style). Buy I would like to set each option with its own color when selected.

Is there any option in chosen for that instead of using an own javascript code? I can't see any information about this at the doc.

This is an example I tried (just to try) but it didn't work (of course lool):

<select name="prueba" multiple class="form-control chosen-select">
                        <option style="background-image: linear-gradient(to bottom, #CCC 0%, #CCC 0%);">option1</option>
                        <option style="background-image: linear-gradient(to bottom, #000 0%, #000 0%);">option2</option>
                    </select>

The color is not about the position, it is based in a property of the model and it will be assigned dynamically

Answer:1

I don't think there is a native code to do that.

I think you should try to write a custom select (like dropdown menu of Bootstrap)

Answer:2

I've got the following array and I'd like to return a new array containing the count of the duplicate ids along with the value of the id: const things = [ { id: 1, title: 'Something', ...

I've got the following array and I'd like to return a new array containing the count of the duplicate ids along with the value of the id: const things = [ { id: 1, title: 'Something', ...

  1. count duplicate values in excel
  2. count duplicate values in sql
  3. count duplicate values in a column in excel
  4. count duplicate values only once in excel
  5. count duplicate values in list python
  6. count duplicate values in r
  7. count duplicate values pandas
  8. count duplicate values in google sheets
  9. count duplicate values in array javascript
  10. count duplicate values in hashmap
  11. count duplicate values in excel pivot table
  12. count duplicate values in array php
  13. count duplicate values in dictionary python
  14. count duplicate values in column sql
  15. count duplicate values in array c#
  16. count duplicate values in mysql
  17. count duplicate values in power bi
  18. count duplicate values in array java
  19. count duplicate values in two columns excel
  20. count duplicate values in a column

my goal for this code is to make it so when one of the tree branches is clicked, it changes the clicked ^ from a ^ to a O using JQuery and Javascript (this is for a school assignment). For example, if ...

my goal for this code is to make it so when one of the tree branches is clicked, it changes the clicked ^ from a ^ to a O using JQuery and Javascript (this is for a school assignment). For example, if ...

I am trying to learn how to use prototypes. I have tried 4 different ways to have my text area and button appear but I cannot figure out why they will not appear. I have commented out the 4 different ...

I am trying to learn how to use prototypes. I have tried 4 different ways to have my text area and button appear but I cannot figure out why they will not appear. I have commented out the 4 different ...

I have an array of objects. In the each object is also another array. Structure: function getData() { return [ { _id: 1, tags: ["tomato", "butter", "milk"], title: "How to ...

I have an array of objects. In the each object is also another array. Structure: function getData() { return [ { _id: 1, tags: ["tomato", "butter", "milk"], title: "How to ...

  1. specific data to
  2. extract specific data from text file python
  3. retrieve specific data from firebase android
  4. extract specific data from website using java
  5. extract specific data from text file
  6. get specific data from json
  7. get specific data from firebase
  8. extract specific data from excel
  9. extract specific data from excel cell
  10. retrieve specific data from firebase
  11. scrape specific data from website
  12. remove specific data from array javascript
  13. read specific data from file c++
  14. get specific data from json python
  15. get specific data from json javascript
  16. extract specific data from pdf
  17. get specific data from json c#
  18. extract specific data from json python
  19. retrieve specific data from firebase javascript
  20. get specific data from json php