Closed
Description
Hi! Nice plugin!
But I've found a little bug. If you have a select box with a blank option, for example:
<select name="example">
<option value=""></option>
<option value="4">Number 4</option>
<option value="5">Number 5</option>
</select>
You will get something like this
I've fix with this code:
this.$element.find('option').each(function() {
var optionClass = $(this).attr("class") !== undefined ? $(this).attr("class") : '';
var text = $(this).text() != '' ? $(this).text() : ' ';
if ($(this).parent().is('optgroup')) {
if ($(this).index() == 0) {
if ($(this)[0].index != 0) {
_liA.push(
'<dt class="optgroup-div">'+$(this).parent().attr('label')+'</dt>'+
'<a tabindex="-1" class="opt '+optionClass+'">'+text+'</a>'
);
} else {
_liA.push(
'<dt>'+$(this).parent().attr('label')+'</dt>'+
'<a tabindex="-1" class="opt '+optionClass+'">'+text+'</a>'
);
}
} else {
_liA.push('<a tabindex="-1" class="opt '+optionClass+'">'+text+'</a>');
}
} else {
_liA.push('<a tabindex="-1" class="'+optionClass+'">'+text+'</a>');
}
});
Google Chrome, MacOS X Mountain Lion
Metadata
Assignees
Labels
No labels