How can I select a hidden field by value?

jquery, jquery-selectors

Solution

Using jQuery Selectors, you can target your element by a certain attribute matching the desired value:

$('input[value="Whatever"]');

This way you are targeting an `input` element, by the attribute `value` that is equal to the desired value.

EDIT 5/14/2013: According to an answer below, this no longer works as of jQuery 1.9.

Problem

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?

Original source

Related problems