Reputation: 6189
I am trying to get all class call Position $(".Position") and get then find the value that == 4 and then show the id.
<input type="Text" id="#34" value="1" class="Position">
<input type="Text" id="#22" value="2" class="Position">
<input type="Text" id="#37" value="3" class="Position">
<input type="Text" id="#41" value="4" class="Position">
Thanks
Upvotes: 0
Views: 303
Reputation: 86882
Use the Attribute Equals Selector
alert($("input.Position[value='4']").attr("id"));
Upvotes: 6
Reputation: 1604
First, you have to take off the '#' from your id's.
<input type="Text" id="34" value="1" class="Position">
Then you can find the input you are looking for with the following selector:
$('input.Position[value=4]').attr('id')
Upvotes: 4