jQuery自动完成wih字体真棒

时间:2019-03-11 13:24:24

标签: jquery autocomplete font-awesome

我想知道是否可以在自动完成列表中添加超棒的字体图标。

如果可以的话,我们可以更改font-awesom图标的样式吗? (例如颜色和字体大小?)

JQUERY

$(function () {
var currencies = [
    {value: '<i class=fas fa-cog></i>'+'Spring', desc: 'Techno'},
    {value: 'J2EE', desc: 'Techno'},
    {value: 'Delphi', desc: 'Techno'},
    {value: 'HTML/CSS', desc: 'Techno'},
    {value: 'PL/SQL', desc: 'Techno'},
    {value: 'PHP', desc: 'Techno'},
    {value: 'C#', desc: 'Techno'},
    {value: 'Javascript', desc: 'Techno'},
    {value: 'AngularJS', desc: 'Techno'},
    {value: 'Liferay ', desc: 'Techno'},
    {value: 'Shell', desc: 'Techno'},
    {value: '<i class=fas fa-mobile-alt></i>+Agranet', desc: 'Appli'},
    {value: 'Etoile', desc: 'Appli'},

];

$('#autocomplete').autocomplete({

    lookup: currencies,
    onSelect: function (suggestion) {
        var thehtml = suggestion.value;

        var html_tag_hidden = $($('.tag_competence_search')[0]).clone();
        html_tag_hidden.show();
        $(html_tag_hidden.children()[0]).html(thehtml);
        $('#nav-test').append(html_tag_hidden);
    }
  });
});

0 个答案:

没有答案