我有上传表单:
<form enctype="multipart/form-data" action="uploader/" method="POST">
<input type="hidden" name="type" value="A">
<br>
Choose a file to upload: <input name="uploadedfileInput" type="file" /><input type="submit" value="Upload File" /><img src="/invite/images/Input.gif" style="margin-left: 140px">
</form>
你可以看到我通过了value="A"
我怎么能把"A"
放在某个返回值的函数中呢?
类似于:
<input type="hidden" name="type" value="getSomeValue()">
JS
...
function getSomeValue(){
return localStorage['some Data'];
}
...
感谢您的帮助,
拍摄:
<input type="hidden" name="type" id="type">
使用jquery,您可以执行以下操作:
jQuery('#type').val('whatever');
或者,不添加id
:
jQuery('input[name="type"]').val('whatever');
返回值属性:
$(selector).val()
设置值属性:
$(selector).val(value)
使用函数设置值属性:
$(selector).val(function(index,currentvalue))