Comparing two variables sting array to see if any value matches - javascript jquery
===

Hi I am trying to compare two arrays to each other and if any of the values match hide a list element.

One array is tags that are attached to a list item and the other is user input. 

I am having trouble as i seem to be able to cross reference one user input work and can't get multiple words against multiple tags. 

The amount of user input words might change and the amount of tags might change. I have tried inArray but have had no luck. Any help would be much appreciated. See code below:

    function query_searchvar()
    {
    var searchquery=document.navsform.query.value.toLowerCase();
    if(searchquery == '')
    {alert("No Text Entered");
    }
    var snospace = searchquery.replace(/\s+/g, ',');
    event.preventDefault();
    var snospacearray = snospace.split(',');
    
    $('li').each(function() {
      var searchtags = $(this).attr('data-searchtags');
      //alert(searchtags);
      var searcharray = searchtags.split(',');
    //alert(searcharray);
    var searchtrue=-1;
    
    for(var i = 0, len = searcharray.length; i < len; i++){
        if(searcharray[i] == searchquery){
            searchtrue = 0;
            break;
        }
    }
    if (searchtrue == 0)
      {
    
     $(this).show("normal");
      }
    else {
    $(this).hide("normal");
    }
    });
    }

