我试图获取“page-template1”页面上每个输入元素的ID和值,但没有成功。
function Temp1() {
var input = [];
$('page-templete1 input[name][id][value]').each(function(){
input.push(this);
cc=$(this).attr('id'));
alert(cc); // trying to get one at time (not working)});
alert(input[0].id); // not working
alert(input[0].attr('id')); // not working
});
alert(input[0].id); // not working
alert(input[0].attr('id')); // not working
如何获取网页中所有输入元素的 ID 和 value,并在稍后访问它们?
注意:我不知道输入元素的 ID 或数量。有一篇旧文章谈到了类似的问题,但没有解决我的问题。
[name][id][value]
。 - Hugo Alves