title: search array for part of a string
body: <p>I'm trying to search my array to see if the value for <code>target</code> match.</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>(function ($) {
      
      $.fn.validate = function (x) {
  
          return this.each(function () {
  
              var wrapper = $(this);
  
              var xx = $.extend({
                  obj: "",
              }, x || {});
  
              function initialized() {
  
                  $(wrapper).children().bind('keyup', function (e) {
                      
                      console.log($.grep(xx.obj, function (t) { return t.target.indexOf($(e.target).attr("name")) }));
  
                  });
  
              }
              initialized();
          });
      };
  
  }(jQuery));
  $('form').validate({ obj: [{ "target": "name=Username", "required": true, "xmin": "5", "xmax": "16" }, { "target": "name=Email", "required": true, "xmin": "5", "xmax": "16" }] });</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"&gt;&lt;/script&gt;
  &lt;form class="form"&gt;
                      &lt;input name="Username" placeholder="Username" /&gt;
                      &lt;input name="Email" placeholder="Email" /&gt;
                      &lt;input type="button" value="Save" /&gt;
                  &lt;/form&gt;</code></pre>
  </div>
  </div>
  </p>
  
  <p>This line: <code>$.grep(xx.obj, function (t) { return t.target == $(e.target).attr("name") }).length</code> returns if it finds a match. I know it says <code>==</code> so it would only return a match if it match exatly. </p>
  
  <p>Is it posible to make it do something like this: <code>$.grep(xx.obj, function (t) { return t.target.contains($(e.target).attr("name")) }).length</code></p>
  
  <p><strong>Edit</strong>
  Changed code to match Z-Bone Answer. still don't work correctly</p>
  
  <p>When a user type in an input field, it will take the <code>Name</code> value <code>($(e.target).attr("name"))</code> from that input and search the <code>xx.obj</code> to see if the value match the any of the <code>obj.target</code>.</p>