title: How do I get a hidden value using Jquery?
body: <p>I am trying to get a hidden field (product) value in my form and pass this through on the thank you page:</p>
  
  <pre><code>&lt;form action="" name="downloadform" id="downloadform"  class="downloadform" method="post"&gt;
          &lt;div class="field"&gt;
          &lt;input name="name" type="text" id="name" class="input name" placeholder="Name..." /&gt;
          &lt;/div&gt;
          &lt;div class="field"&gt;
          &lt;input name="company" type="text" id="company" class="input company" placeholder="Company..." /&gt;
          &lt;/div&gt;
          &lt;div class="field"&gt;
          &lt;input name="tel" type="text" id="tel" class="input tel" placeholder="Telephone..." /&gt;
          &lt;/div&gt;
          &lt;div class="field"&gt;
          &lt;input name="email" type="text" id="email" class="input email" placeholder="Email Address..." /&gt;
          &lt;/div&gt;
          &lt;?php /*?&gt;&lt;div class="field captcha"&gt;
          &lt;img class="captcha_input" src="/inc/captcha.php" /&gt;
          &lt;input name="captcha" type="text" id="captcha" class="input captcha" placeholder="Please enter characters..."&gt;
          &lt;/div&gt;&lt;?php */?&gt;
          &lt;div class="field"&gt;
          &lt;div class="medium secondary btn"&gt;&lt;input type="submit" name="Submit2" value="Send Request" class="btn" id="downloadbtn" /&gt;&lt;/div&gt;
          &lt;input type="hidden" name="product" id="product" class="product" value="&lt;?php echo $page[3]; ?&gt;" /&gt;
          &lt;input type="hidden" name="antiSpam" id="antiSpam" /&gt;
          &lt;/div&gt;
      &lt;/form&gt;
  </code></pre>
  
  <p>I have an ajaxform file as follows below:</p>
  
  <pre><code>var antiSpam = function() {
      if (document.getElementById("antiSpam")) {
          a = document.getElementById("antiSpam");
          if (isNaN(a.value) == true) {
              a.value = 0;
          } else {
              a.value = parseInt(a.value) + 1;
          }
      }
      setTimeout("antiSpam()", 1000);
  }
  </code></pre>
  
  <p>antiSpam();</p>
  
  <pre><code>$(function() {
  
    filter = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
  
    $("#downloadbtn").click(function() {
  
          var name = $("#name").val();
          var company = $("#company").val();
          var tel = $("#tel").val();
          var email = $("#email").val();
          var product = $("#product").val();
          var antispam = $("#antiSpam").val();
  
          if (name == "") {
            $("#name").focus();
            $("#name").val("");
            $("#name").css({background:"#b72a18", color:"#fff"});
            return false;
          }
          if (company == "") {
            $("#company ").focus();
            $("#company ").val("");
            $("#company ").css({background:"#b72a18", color:"#fff"});
            return false;
          }
          if (tel == "") {
            $("#tel").focus();
            $("#tel").val("");
            $("#tel").css({background:"#b72a18", color:"#fff"});
            return false;
          }
          if (!filter.test(email)) {
            $("#email").focus();
            $("#email").val("");
            $("#email").css({background:"#b72a18", color:"#fff"});
            return false;
          }
          if (product == "") {
            $("#product").focus();
            $("#product").val("");
            $("#product").css({background:"#b72a18", color:"#fff"});
            return false;
          }
  
          $('.downloadform').html('&lt;center&gt;&lt;img src="/images/ajax-loader.gif" style="padding:20px;"&gt;&lt;/center&gt;');
  
          var dataString = '&amp;name=' + name + '&amp;tel=' + tel + '&amp;company=' + company + '&amp;email=' + email + '&amp;product=' + product + '&amp;antispam=' + antispam + '&amp;type=download';
          //alert (dataString);return false;
  
          $.ajax({
              type: "POST",
              url: "/process.php",
              data: dataString,
              success: function() {
  
                  setTimeout(function() {
                      $('.downloadform').html('&lt;p&gt;Thank you for your enquiry, we will contact you shortly. &lt;a href="/pdfs/"&gt;Download&lt;/a&gt;&lt;/p&gt;');
                  }, 3500);
              }
       });
      return false;
      });
  });
  </code></pre>
  
  <p>As above on the very last part "Thank you for your enquiry, we will contact you shortly, I would like to get the hidden field product value?</p>