我有一张表格
<form id="post_comment" action="cmt.PHP" method="post"> <input type="hidden" name="type" value="sub" /> <textarea id="body"></textarea> </form>
我正在使用此代码访问表单
$("#post_comment").submit(function(event){ var form = $(this); });
如何获得< input type =“hidden”的值name =“type”value =“sub”/>从这种形式.
我试图使用form.input(“type”),但它无法正常工作.
解决方法
$("#post_comment").submit(function(event){ var inputValue = $("input[name='type']",this).val(); });