How to add html placeholder to select2?

后端 未结 4 1675
南旧
南旧 2021-01-18 06:39

I want to add one icon to placeholder like this

$(\"#tag_list\").select2({
    allowClear: true,
    placeholder: \"         


        
4条回答
  •  -上瘾入骨i
    2021-01-18 07:02

    You can specify a placeholder object, rather than only the text. This will render the HTML.

    So in your case, the placeholder might look something like this.

    $("#tag_list").select2({
        placeholder: {
            id: "-1",
            text: '  input your tags...'
        }
    });
    

提交回复
热议问题