0

Using jQuery's .find() method to return a set of elements, I am trying to access items in the returned set by their order in that set.

For example, a table with two rows and in each row a select box and two text input fields, accessed with the following:

$('table#tbl').find('tr.row').each(function(i)
{

});

To get the first element I would have thought I could use

$('table#tbl').find('tr.row').each(function(i)
{
    alert( $(this).find(':input').get(1).val() );
});

And variations of the above, but apparently this doesn't work. Could anyone suggest the correct method to access item x of n elements returned?

Edit:

JSFiddle here: http://jsfiddle.net/Lenqt/42/

Gga
  • 4,311
  • 14
  • 39
  • 74
  • possible duplicate of [How to get nth jQuery element](http://stackoverflow.com/questions/1442925/how-to-get-nth-jquery-element) – Felix Kling Jun 12 '12 at 10:43

1 Answers1

0
alert( $(this).find(':input:eq(0)').val() );
U.P
  • 7,357
  • 7
  • 39
  • 61