Tarek Saied
Tarek Saied

Reputation: 6616

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

i use php and mysql to get my icons and elements

i try to use span and give it an icon as a background image but it's not working

            <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>

Upvotes: 1

Views: 1605

Answers (1)

StrubT
StrubT

Reputation: 1028

Please have a look at the following jQuery UI demo.

The first example is most likely what you are looking for. The source code is available too.

Upvotes: 1

Related Questions