Insert Placeholder that contains HTML


#1

Hello,

Just started using Select2 and am trying to solve for something that the designer gave us. Normally I would do something like this:
image
But that does not work with the way the PLACEHOLDER function works.

Can’t post more than one image, so will continue in reply if I can.


#2

Continuing with next description and image:

If I try to do this:
image
Then it does swap in the text, but it does not escape the text.

to be continued…


#3

… continued:

This means I end up with something that looks like this:
image

What is the best way to approach this?

Thanks!


#4

This documentation explains how to style the placeholder: https://select2.org/placeholders#customizing-placeholder-appearance. Note that you have to do this in JavaScript; you can’t do it with the data-placeholder attribute.