I am trying to create an option in a SelectField
that uses an embedded span
in the label. However, the tag is escaped and displayed literally in the field.
I've tried Embed HTML tag in Flask WTForms field but it doesn't work in this case (likely because the text that needs to be escaped is inside a list).
Is it possible to render the HTML unescapped in the option label without writing my own renderer?
class myForm(Form):
myChoices = [
('0','Select an option <span class="caret"></span>'),
('1','Option 1'),
('2','Option 2')
]
optionSelect = SelectField('Select', choices=myChoices, validators=[Required()])