0

I'm using a select element in Angular 5 with bootstrap 3. I think it's a WebForms / Bootstrap component. Is it possible to attach images to the different options? Perhaps using CSS?

           <select (change)="course.active = !course.active"
                    name="myselect">
                <option [selected]="course.active" >
                    Option 1
                </option>
                <option [selected]="!course.active" >
                    Option 2
                </option>
            </select>    
Jojje
  • 1,749
  • 3
  • 25
  • 44

1 Answers1

2


It's a duplicate question, you can find your answer there:

Adding images with option tag
How to add images in select list?
Image in SELECT element

You can't add image inside <option> the DOM doesn't allow it, <option> tag only accept plain text... so yes you need to add image using CSS and style="background-image" attribute to make it work.

I hope it help you :)

Max
  • 794
  • 3
  • 7