mos*_*toh 4 html javascript css jquery jquery-select2
我使用select2版本4
我试着这样:
$("select02").select2({
placeholder: "<i class='fa fa-sitemap'></i>Branch name",
});
Run Code Online (Sandbox Code Playgroud)
但是,它不起作用
演示是这样的:http://jsfiddle.net/fc1qevem/8/
解决我的问题的任何解决方案?
小智 11
务必先阅读参考/手册!
来自他们网站上的官方select2示例;
function formatState (state) {
if (!state.id) { return state.text; }
var $state = $(
'<span><img src="vendor/images/flags/' + state.element.value.toLowerCase() +
'.png" class="img-flag" /> ' +
state.text + '</span>'
);
return $state;
};
$(".js-example-templating").select2({
templateResult: formatState
});
Run Code Online (Sandbox Code Playgroud)
给你结果:
小智 6
所以你需要的是:
$("select02").select2({
placeholder: '<i class="fa fa-sitemap"></i>Branch name',
escapeMarkup : function(markup) {
return markup;
}
});
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
11353 次 |
| 最近记录: |