如何使用jquery从隐藏的文件中提取id元素? [英] How to extract id elments from hidden filed using jquery?
本文介绍了如何使用jquery从隐藏的文件中提取id元素?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有以下表格.由此,我想要每个隐藏字段的id
.怎么做.是否可以使用jquery Remove方法
I have following form. From this i want id
of each hidden field. How to do that. Is it possible to remove hidden element using id
of hidden elements by jquery Remove methods
表格:
<form id="postform" method="post" action="/test/MapIcon">
<input type="submit" value="Match">
<input id="65" type="hidden" name="image" value="../../Images/wi0096-48.gif">
<input id="66" type="hidden" name="image" value="../../Images/down.png">
<input id="67" type="hidden" name="image" value="../../Images/wi0054-48.gif">
</form>
我已经尝试过这种方式:这个jquery方法
I have tried in this way: This jquery methods
var alts = $(this).attr("id");
var alts = $(this).attr('id');
var alts = jQuery(this).attr("id");
var ref = "#";
ref += alts.toString();
alert(ref);//getting # value only
我已经尝试过,但仅获得#值.所以请给我一些想法.
I have tried but getting # value only .So please give me some idea .
推荐答案
var hiddenIds = [];
$('input:hidden').each( function() {
hiddenIds.push($(this).attr('id'));
});
输出是hiddenIds
数组.
这篇关于如何使用jquery从隐藏的文件中提取id元素?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文