简体   繁体   English

如何在jQuery UI选择菜单上添加自定义图标

[英]how to add custom icon on jquery ui select menu

i use jquery UI Select menu and i want to make a custom icon for every option tag 我使用jquery UI 选择菜单 ,我想为每个选项标签创建一个自定义图标

i use php and mysql to get my icons and elements 我使用php和mysql获取图标和元素

i try to use span and give it an icon as a background image but it's not working 我尝试使用span并给它一个图标作为背景图像,但是它不起作用

            <label class="langLabel" for="filesA">Select your language:</label>
            <select name="filesA" id="filesA">
                <?php 

                $langs  = select("*","lang");
                while($lang=fa($langs)){
                    echo "<option value={$lang['lang_id']} data-class=\"ui-icon-script\">{$lang['lang_full_name']}
                    </option>";
                    echo "<span class='test' style='background: url('".
                       "img/flags2".$lang['lang_flag'] ."') />";
                }

                ?>

        </select>

Please have a look at the following jQuery UI demo . 请看下面的jQuery UI演示

The first example is most likely what you are looking for. 第一个例子很可能是您要寻找的东西。 The source code is available too. 源代码也可用。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM