Skip to content
This repository has been archived by the owner on Mar 12, 2022. It is now read-only.

Commit

Permalink
Fixes class fills in case no class is defined.
Browse files Browse the repository at this point in the history
Provides default class for prompt.
  • Loading branch information
Hall, Will committed Jan 26, 2015
1 parent 95b0c63 commit 65bf31e
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions foundation-select.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,14 @@
return this.each(function () {
selectPrompt = '';
selected = '';
translateClasses = '';
select = $(this);
selectId = select.attr('id');
multiple = false;
multiple = select.prop('multiple') ? true : false;
options = '';
if (select.data('prompt')) {
selectPrompt = select.data('prompt');
selectPrompt = '<span class="default-label">' + select.data('prompt') + '</span>';
options = '<li class="disabled">' + selectPrompt + '</li>';
} else {
selectPrompt = 'Choose...';
Expand All @@ -25,7 +26,10 @@
selected = 'selected';
selectPrompt = "<div class='" + $(this).attr('class') + "'>" + $(this).html() + "</div>";
}
options += '<li data-value="' + this.value + '" class="' + $(this).attr('class') + ' ' + selected + '"><span class="option-title">' + $(this).html() + '</span></li>';
if( $(this).attr('class') ) {
translateClasses = $(this).attr('class') + ' ';
}
options += '<li data-value="' + this.value + '" class="' + translateClasses + selected + '"><span class="option-title">' + $(this).html() + '</span></li>';
selected = '';
});
newButton = '<div class="custom-dropdown-area" data-orig-select="#' + selectId + '"' + (multiple ? ' data-multiple="true"' : '') + '><a href="#" data-dropdown="select-' + selectId + '" class="custom-dropdown-button">' + selectPrompt + '</a> \
Expand Down

0 comments on commit 65bf31e

Please sign in to comment.