title: JS jQuery - check if value is in array
body: <p>I am more of a PHP person, not JS - and I think my problem is more a syntax problem ..</p>
  
  <p>I have a small jQuery to "validate" and check input value .</p>
  
  <p>It works ok for single words, but I need array.</p>
  
  <p>I am using the  <code>inArray()</code> of jQuery .</p>
  
  <pre><code>var ar = ["value1", "value2", "value3", "value4"]; // ETC...
  
          jQuery(document).ready(function() {
  
              jQuery("form#searchreport").submit(function() {
              if (jQuery.inArray(jQuery("input:first"), ar)){ 
                        //if (jQuery("input:first").val() == "value11") { // works for single words
              jQuery("#divResult").html("&lt;span&gt;VALUE FOUND&lt;/span&gt;").show();
              jQuery("#contentresults").delay(800).show("slow");
                  return false;
                }
  
          // SINGLE VALUE SPECIAL CASE / Value not allowed 
                 if (jQuery("input:first").val() == "word10") {
  
                  jQuery("#divResult").html("YOU CHEAT !").show();
                  jQuery("#contentresults").delay(800).show("slow");
  
                  return false;
                }
  
          // Value not Valid
  
                jQuery("#divResult").text("Not valid!").show().fadeOut(1000);
  
                return false;
              });
  
          });
  </code></pre>
  
  <p>now - this <code>if (jQuery.inArray(jQuery("input:first"), ar))</code>  is not working right .. every value that I put will be validated as OK . (even empty)</p>
  
  <p>I need to validate only values from the array (ar) .</p>
  
  <p>I tried also <code>if (jQuery.inArray(jQuery("input:first"), ar) == 1) // 1,0,-1 tried all</code></p>
  
  <p>what am i doing wrong ?</p>
  
  <p>Bonus question : how to do NOT in array in jQuery ?? 
  (the equivalent of PHP <code>if (!in_array('1', $a))</code>  - I sw somehre that it will not work , and need to use something like this : <code>!!～</code></p>