获取隐藏的字段值Jquery?

Dea*_*ean 5 javascript jquery

我有以下HTML

<input type="hidden" name="conf1" value="7th IEEE/IFIP International Conference on Embedded and Ubiquitous Computing (EUC-09)">
    <input type="hidden" name="conf2" value="IEEE International Symposium on Parallel and Distributed Processsing with Applications">
    <input type="hidden" name="conf3" value="jkhga">
    <input type="hidden" name="conf4" value="test">
    <input type="hidden" name="conf5" value="The 3rd International Conference on Adaptive Business Information Systems (ABIS'09)">

    <input type="text" name="published">
Run Code Online (Sandbox Code Playgroud)

我试图使用jquery将隐藏字段的值放入数组中.这是我尝试过的:

 var conferences = new Array();

        conferences[0] = $('#conf1').val();
        conferences[1] =$("[name='conf2']").val();
        conferences[2] =$("[name='conf3']").val();
        conferences[3] = $("[name='conf4']").val();
        conferences[4] =$("[name='conf5']").val();     
Run Code Online (Sandbox Code Playgroud)

任何人都可以指导我如何阅读它们吗?
先谢谢
Dean

use*_*716 10

如果你打算使用jQuery,你可以这样做:

var array = $('input:hidden').map(function() {
    return this.value;
}).get();
Run Code Online (Sandbox Code Playgroud)

.map() 迭代集合,并将返回值放入jQuery对象.

.get() 从jQuery对象中检索数组.