如何按值选择隐藏字段? [英] How can I select a hidden field by value?
本文介绍了如何按值选择隐藏字段?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个由ASP.NET中继器生成的以下HTML:
I have the following HTML generated by an ASP.NET repeater:
<table>
<tr>
<td><input type="hidden" name="ItemId" id="ItemId" value="3" /></td>
<td>Terry</td>
<td>Deleted</td>
<td>Low</td>
<td>Jun 21</td>
</tr>
<!-- rows repeat -->
</table>
如何通过值选择特定的隐藏字段,以便随后可以操纵其旁边的列?
How do I select a particular hidden field by value, so that I can then manipulate the columns next to it?
推荐答案
使用 jQuery选择器 ,您可以通过匹配所需值的某个属性来定位您的元素:
Using jQuery Selectors, you can target your element by a certain attribute matching the desired value:
$('input[value="Whatever"]');
通过这种方式,您可以通过等于所需值的属性value
定位input
元素.
This way you are targeting an input
element, by the attribute value
that is equal to the desired value.
编辑5/14/2013::根据以下答案,此版本自jQuery 1.9起不再有效.
EDIT 5/14/2013: According to an answer below, this no longer works as of jQuery 1.9.
这篇关于如何按值选择隐藏字段?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文