Skip to content

Commit

Permalink
Support function input to selectClass option.
Browse files Browse the repository at this point in the history
So you can pass a function into the selectClass option. Pass $el as 'this' to the function to allow context-aware class definitions.

For example:

  $('select').uniform({
    selectClass: function() {
      var cls = this.data('uniform-class');
      return (cls !== undefined && cls.length > 0 ? 'selector ' + cls : 'selector');
    }
  });
  • Loading branch information
ericfreese committed Feb 14, 2013
1 parent f5be2cd commit 51c6a87
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion jquery.uniform.js
Original file line number Diff line number Diff line change
Expand Up @@ -782,7 +782,7 @@ Enjoy!
}

ds = divSpan($el, options, {
divClass: options.selectClass,
divClass: (typeof options.selectClass === "function" ? options.selectClass.apply($el) : options.selectClass),
spanHtml: ($el.find(":selected:first") || $el.find("option:first")).html(),
spanWrap: "before"
});
Expand Down

0 comments on commit 51c6a87

Please sign in to comment.