I've populated List with font-awesome strings like:
private static readonly List<string> Icons = new(){
"<i class=\"fas fa-users\"></i>",
"<i class=\"fas fa-user-tag\"></i>",
"<i class=\"fas fa-sitemap\"></i>",
"<i class=\"fas fa-cubes\"></i>",
"<i class=\"fas fa-shield-alt\"></i>"
};
And in View i have a dropdown:
<select asp-for="Icon" class="form-control" asp-items="ViewBag.Icons"></select>
and then when I display them in SelectList I get:
I would like to render them as html and display icons, not strings. Is it possible? Maybe with JS or jQuery?
CodePudding user response:
You cannot render <i>
icon element in <option>
element as asked this question: