Accessing Hidden Field Value in Jquery
<p>My form looks like the following</p>

<pre><code>&lt;form class="search_results_section" method="post" name="MainForm" id="MainForm" action="/searchresults.asp" onsubmit="return OnSubmitSearchForm(event, this);"&gt;
            &lt;input type="hidden" name="Search" value=""&gt;
            &lt;input type="hidden" name="Cat" value="1856"&gt;
&lt;/form&gt;
</code></pre>

<p><strong>I want to get the "Cat" value of Hidden field in a Variable</strong> </p>

<p>I tried using the following but not sure why its not working</p>

<pre><code>  var elements =$('#jmenuhide input[name^="Cat"]').val();
      alert(elements);
  var ele=document.MainForm.getElementsByName('Cat').value;
      alert(ele);
</code></pre>

<p>The alert says "undefined"</p>
