title: Bootstrap Multiselect filtering values based on another dropdown
body: <p>I'm working on cascading the multi-select based on the values of the data-attributes on another. </p>
  
  <p>I have this method which is called inside the onChanged event of the parent. By parent I mean what to filter the child by i.e </p>
  
  <ul>
  <li>Parent = Department Multiselect</li>
  <li>Child = Staff Multiselect. </li>
  </ul>
  
  <p>The child element has a data attribute of <code>data-departmentid</code>. </p>
  
  <pre><code>function cascadeMultiselect(control, targetControl, key) {
           this.control = control;
           this.targetControl = targetControl;
           this.key = key;
           this.toHide = [];
           this.toShow =[];
           //Get controls selectedIds
           this.selectedIds = function() {
               var selected = [];
               _.each($(this.control + " option:selected"), function(c) {
                   selected.push($(c).val());
               });
               return selected;
           };
  
           //Now filter 
           this.filter = function() {
  
               //Get target control attribute values
               _.each($(targetControl + " option"), function(tc) {
                   //Use the val as an identifier
                   var val = $(tc).val();
                   var data = $(tc).attr("data-" + key);
                   data = data.split(",");
  
                   var isMatch = anyMatchInArray(data, this.selectedIds());
  
                   if(!isMatch){
                     $(tc).hide();
                   }
               });
           }
  
            this.filter();
  
            $(targetControl).multiselect('rebuild');           
       }
  </code></pre>
  
  <p>It's being called like so: </p>
  
  <pre><code> onChange: function() {
               cascadeMultiselect('#departmentlist', '#stafflist', "DepartmentID");
           }
  </code></pre>
  
  <p>The problem is I can't hide the elements. The filter works just fine, I've tried: </p>
  
  <p><code>$(tc).hide(); // tc = targetControl option</code></p>
  
  <p>I've also tried to refresh instead of rebuild. </p>