1
我想在输入文件字段中使用选择器来获取隐藏字段的值,如下面的代码所示,但我总是得到undefined作为返回值,请有人请告诉我我在想什么?谢谢。JQuery抓取隐藏字段的值
<form id="form1" method="POST">
<input type="hidden" id="docID1" name="docID1" value="1234">
<div class="fileUpload">
<button id="uButton" onclick="return false;">Browse</button>
<input id="uplA" name="uplA" type="file" class="upload" multiple />
</div>
</form>
查询:
var docIDInHiddenField = $('#uplA').parent('[name=docID1]').val();
console.log(docIDInHiddenField); //return undefined
也许很容易使用$('#docID1')。val()?没有? – 2015-04-02 14:31:29