Passing functions to options in jQuery UI

Passing functions to options in jQuery UI

It would be nice if I could pass a function as an option when using jQuery UI, like I can in jQuery 1.4 with the .val() method. For example:

  1. $(":button, :submit, :reset").button({
  2.     icons: {
  3.         primary: function (element) {
  4.             return findIconClass(element);
  5.         }
  6.     }
  7. });
(where findIconClass() returns any 'ui-icon-*' css classes on the element)