0

我使用了下面的代码 jQuery("#change").submit(function() {

  jQuery.each(jQuery('input[type=password]'),function(index,value){

//我需要获取密码输入字段值的值以进行验证

});
return false;

});

我还在表单中使用了三个密码输入字段

请任何人帮助我如何在jquery每个函数中获取值?

4

3 回答 3

3
$('input[type=password]').each(function(){
    alert($(this).val());
});
于 2012-07-19T07:25:27.913 回答
1
$('input[type=password]').each(function(i,item){ alert( $(item).val() ) })
于 2012-07-19T07:26:46.667 回答
0

只需修改您的代码,如下所示

            $('input[type=password]').each(function(index,value)
            {
                // Here value(parameter) is an object
                alert(value.value);
            });
于 2012-07-19T07:31:18.027 回答