use for each to get each input value [on hold]

<p>I'm expecting value 1 and 2 but it returned null instead. Any idea why is this happening?</p><div class="snippet" data-lang="js" data-hide="false"><div class="snippet-code"><pre class="snippet-code-js lang-js prettyprint-override"><br /><code>$(function() {<br /><br /> $('.agent_rows').each(function() {<br /> console.log($(this).find('input[name="associatedAgentId"]').val())<br /> })<br /><br />});</code><br /></pre><pre class="snippet-code-html lang-html prettyprint-override"><br /><code><script src="http://ift.tt/1oMJErh"></script><br /><div class="agent_rows"><br /> <input type="hidden" name="associatedAgentId" val="1"><br /></div><br /><br /><div class="agent_rows"><br /> <input type="hidden" name="associatedAgentId" val="2"><br /></div></code><br /></pre></div></div><br /><h2>Click here view more answers <a href="%20http://stackoverflow.com/questions/34525387/use-for-each-to-get-each-input-value">http://ift.tt/1ks1O2R</a></h2>

Nhận xét

Bài đăng phổ biến từ blog này

Align div to bottom of the page in bootstrap

Align elements inside an tag vertically

Javascript is unable to stop page loading