jQuery EasyUI form - format drop-down box

This tutorial shows you how to create a simple dropdown box (Combobox) that displays image items in the dropdown box. You can use the formatter function on the combobox to tell it how to format each item.

Create image drop-down box (Combobox)

    <input id="cc" style="width:100px"
            url="data/combobox_data.json"
            valueField="id" textField="text">
    </input>
    $('#cc').combobox({
        formatter:function(row){
            var imageFile = 'images/' + row.icon;
            return '<img decoding="async" class="item-img" src="'+imageFile+'"/><span class="item-text">'+row.text+'</span>';
        }
    });

 

Guess you like

Origin blog.csdn.net/unbelievevc/article/details/130677191