title: Multiple Conditional JQuery Contains Search
body: <p>I am modifying an Instant JQuery Search for use on a sharepoint list with multiple columns.</p>
  
  <p>I have almost got this working right, but having trouble with using AND conditions as well as OR conditions.  </p>
  
  <p>the search box looks like so,</p>
  
  <p>User1 OR User2,Customer</p>
  
  <p>this is how I would like the users to search.. meaning they can search for User1 OR User2 AND Customer.  What this should produce is pretty straight forward, and this is how I think it should look.  But it's not doing the AND operator on Customer.  </p>
  
  <pre><code>tr.ms-itmhover:Contains('User1'),tr.ms-itmhover:Contains('User2'):tr.ms-itmhover:Contains('Customer')
  </code></pre>
  
  <p>below is my javascript:</p>
  
  <pre><code> var txt = $("input.search").val().split(',');
           var str = "";
           var strnot = "";
           if (txt)
           {
               for(var i=0;i&lt;txt.length;i++) {
                  var txt2 = txt[i].split('OR');
                  if (txt2.length &gt; 1) {
                      for (var j=0;j&lt;txt2.length;j++) {
                          if (j==0) {
                              str += "tr.ms-itmhover:Contains('"+txt2[j].toString().trim() +"')";
                          }
                          else {
                              if (txt2[j].length &gt; 0) {
                                  str += ",tr.ms-itmhover:Contains('"+txt2[j].toString().trim() + "')";
                              }
                          }
                      }
                  }
                  else {
                      if (txt[i].length &gt; 0) {
                          if (i == 0)
                              str += "tr.ms-itmhover:Contains('"+txt[i].toString().trim() +"')";
                          else
                              str += ":tr.ms-itmhover:Contains('"+txt[i].toString().trim() +"')";
                      }
                  }
               }
               $("#temp").html(str);
  
               //$("#WebPartWPQ2").find(str).hide();     
               //$("#WebPartWPQ2").find(str).show();    
  
              $("#WebPartWPQ2").find("tr.ms-itmhover:not("+str+")").hide();     
              $("#WebPartWPQ2").find("tr.ms-itmhover"+str+"").show();    
          } 
          else 
          {   
              $("#WebPartWPQ2").find("tr.ms-itmhover").show();
          }
  </code></pre>