title: jQuery How to retrieve the name of an input text field using JQuery
body: <pre><code>&lt;!DOCTYPE html&gt;
  &lt;html&gt;
  &lt;head&gt;
    &lt;script src="http://code.jquery.com/jquery-latest.js"&gt;&lt;/script&gt;
    &lt;script&gt;
    $(document).ready(function(){
      var pValue = $(".blah").find("p").html();
          alert(" Information in Paragraph tag is ### " + pValue);`enter code here`
  
      $(".blah").find($("input:text")).each(function(){
          alert("Value inside the Input text field is #### " + this.value);
      });
  }); 
  
    &lt;/script&gt;
  &lt;/head&gt;
  &lt;body&gt;
  
      &lt;div class="blah"&gt;
        &lt;p&gt;he he he&lt;/p&gt;
        &lt;input "type = text name ="userName" value = "abc"/&gt;
        &lt;input "type = text name ="id" value = "xyz"/&gt;
      &lt;/div&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>Question:</p>
  
  <p>When i run the above HTML code i get the following alerts</p>
  
  <ul>
  <li>Information in Paragraph tag is ### he he he</li>
  <li>Value inside the Input text field is #### abc</li>
  <li>Value inside the Input text field is #### xyz</li>
  </ul>
  
  <p>I want to retrieve the input text field names (username and id) and place it in the alerts dynamically so that my alerts look as shown below. I want this functionality because if the user enters his username and not the id. i want to display that his id is empty.</p>
  
  <ul>
  <li>Information in Paragraph tag is ### he he he</li>
  <li>Value inside the userName is #### abc</li>
  <li>Value inside the id is #### xyz</li>
  </ul>
  
  <p>Thanks a lot in advance.</p>