title: How to dynamically get a name attribute of input type="text" and disable or enable it using JQuery?
body: <p>can anyone help me with how to get a textfield name attribute and check in an array then disable or enable that field accordingly.below is my code </p>
  
  <pre><code> $("input").each(function () {
      //alert();
      var check = $(this).attr('name');
      $("input[name='noListStrings[0]']").prop("disabled", true);
      if (check != undefined &amp;&amp; $("input[name='" + check + "']").is(":hidden") == false) {
          for (var i = 0; i &lt; yesListStrings.length; i++) {
              //alert("yesLoop");
              if (check == yesListStrings[i]) {
                  alert("yesList");
                  $("input[name='" + $(this).attr('name') + "']").attr("disabled", false);
              }
          }
          for (var i = 0; i &lt; noListStrings.length; i++) {
              //alert("noLoop");
              if (check == noListStrings[i]) {
                  alert("nolist");
                  $("input[name='" + check + "']").attr("disabled", true);
              }
          }
      }
  });
  </code></pre>
  
  <p>I am checking the field name and if its present in that array i am disabling or enabling the field.
  I have tried using <code>$.inArray(fieldname,myarr)</code> its not working.So please don't suggest me to use <code>$.inArray()</code>.</p>