you need to set the $styledSelect.html with the $this.find(":selected").data('icon') like this
$('select').each(function() {
var $this = $(this),
dataui = $this.children('option'),
numberOfOptions = dataui.length;
$this.addClass('s-hidden');
$this.wrap('<div class="select"></div>');
$this.after('<div class="styledSelect"></div>');
var $styledSelect = $this.next('div.styledSelect');
//$this.find(":selected").data('icon') the actual icon
$styledSelect.html('<img src="'+$this.find(":selected").data('icon')+'" />');
var $list = $('<ul />', {
'class': 'options'
}).insertAfter($styledSelect);
for (var i = 0; i < numberOfOptions; i++) {
$('<li />', {
text: $this.children('option').eq(i).text(),
rel: $this.children('option').eq(i).val()
}).appendTo($list);
}
var $listItems = $list.children('li');
$styledSelect.mouseover(function(e) {
e.stopPropagation();
$('div.styledSelect.active').each(function() {
$(this).removeClass('active').next('ul.options').hide();
});
$(this).toggleClass('active').next('ul.options').toggle();
});
$listItems.click(function(e) {
e.stopPropagation();
//select the option
$this.val($(this).attr('rel'));
//set the icon
$styledSelect.html('<img src="'+$this.find(":selected").data('icon')+'" />').removeClass('active');
$list.hide();
});
$('.select').mouseleave(function() {
$styledSelect.removeClass('active');
$list.hide();
});
});