Merge pull request #18550 from eileenmcnaughton/search
[civicrm-core.git] / js / Common.js
index f42314f6edb801a0073e49da604dd4de5e10c771..881dda124d0a546a3a3f1aaafd0936033dba3c05 100644 (file)
@@ -289,6 +289,17 @@ if (!CRM.vars) CRM.vars = {};
     return rendered;
   };
 
+  CRM.utils.getOptions = function(select) {
+    var options = [];
+    $('option', select).each(function() {
+      var option = {key: $(this).attr('value'), value: $(this).text()};
+      if (option.key !== '') {
+        options.push(option);
+      }
+    });
+    return options;
+  };
+
   function chainSelect() {
     var $form = $(this).closest('form'),
       $target = $('select[data-name="' + $(this).data('target') + '"]', $form),