babonk babonk - 1 year ago 63
Javascript Question

Dropdown select with images

I wanted to create a dropdown select which has images instead of text as the options. I've done some Googling and searching here on Stack Overflow, and the answer generally given is to use the jQuery combobox.

The problem with this solution, it seems to me, is that you have to provide text. It looks like the images are just icons that accompany that text on the left. Correct me if I'm wrong, but this solution wouldn't cover what I'm trying to do-- which is completely replace the text with images.

Some background on what I'm trying to do-- I'm trying to create a dropdown for users to select line thickness on an online painting/doodling app. The images would be lines of different thickness, kind of like mspaint.

Answer Source

Check this example .. everything has been done easily

EDIT: Updated/working as of 2013, July 02:


<select name="webmenu" id="webmenu">
    <option value="calendar" title=""></option>
    <option value="shopping_cart" title=""></option>
    <option value="cd" title=""></option>
    <option value="email"  selected="selected" title=""></option>
    <option value="faq" title=""></option>
    <option value="games" title=""></option>

$("body select").msDropDown();