Error when get value from input[type="hidden"]
<p>in index.php</p>

<pre><code>&lt;input type="hidden" name="id" value="1" /&gt;
&lt;input type="hidden" name="type" value="2" /&gt;
</code></pre>

<p>in script.js</p>

<pre><code>$(document).ready(function(){
     $('#button').click(function(){
       var id = $(this).prev('input[type="hidden"][name="id"]').val();
       var type = $(this).prev('input[type="hidden"][name="type"]').val();
       alert(id);
       alert(type);

});
</code></pre>

<p>when I run file index.php, result is undefined, how to fix it</p>
