<select id="convert-from">
<option value="usd">Доллар США </option>
<option value="ru">Российский рубль</option>
<option value="eu">Евро</option>
</select>
<head>
<link href="select2.css" rel="stylesheet"/>
<script src="select2.js"></script>
<link href="bootstrap.css" rel="stylesheet"/>
<script src="bootstrap.js"></script>
<script>
function format(state) {
if (!state.id) return state.text; // optgroup
return "<img class='flag' src='images/flags/" + state.id.toLowerCase() + ".png'/>" + state.text;
}
$("#e4").select2({
formatResult: format,
formatSelection: format,
escapeMarkup: function(m) { return m; }
});
</script>
</head>
<body>
<script>
function format(state) {
var originalOption = state.element;
return "<img class='flag' src='images/flags/" + state.id.toLowerCase() + ".png' alt='" + $(originalOption).data('foo') + "' />" + state.text;
}
</script>
<select>
<option value="AL" data-foo="bar">option one</option>
<option value="1" data-foo="bar">option</option>
<option value="3" data-foo="bar">option</option>
</select>
</body>
<select id='imgCombo' onChange="javascript: doIcon( this.value );" style="width: 65px;" class="icon">
<option style="background-image: url(imgselect/01.gif);" class="icon" value="01">2</option>
<option style="background-image: url(imgselect/02.gif);" class="icon" value="02">3</option>
<option style="background-image: url(imgselect/03.gif);" class="icon" value="03">4</option>
<option style="background-image: url(imgselect/04.gif);" class="icon" value="04">5</option>
<option style="background-image: url(imgselect/05.gif);" class="icon" value="05">4</option>
<option style="background-image: url(imgselect/06.gif);" class="icon" value="06">4</option>
</select>