How to add images in select list?

后端 未结 14 1456
小鲜肉
小鲜肉 2020-11-21 11:18

I have a select list of genders.

Code:


                    
}
@foreach (var version in Model.Versions) {
}
}

Using JS for the checkbox deselection we can have multiple instances on a form. Here I've extended to show a list of Expansions, which also have the same logic around versions.

Include Expansions?
@foreach (var expansion in Model.Expansions) {

Of course this requires a fair bit of CSS, which I've only included in this JSFiddle to reduce the size of this already massive answer. I've used Bootstrap 4 to reduce the amount needed, and also to allow it to fit in with other Bootstrap controls and any site customisations that have been made.

The images are set to 75px, but this can easily be changed in 5 lines in .rich-select and .rich-select-option-body img

提交回复
热议问题