Reputation: 13672
I am trying to grab the first item in a set but none of the examples i have seen on traversing really fit the format I am using. Any help would be greatly appreciated.
function popagateDegreeUpwards(obj, sectionNum, compLev, counter)
{
var ddl = $(obj);
var oneTierUpPnl = ddl.parent('.Section' + (sectionNum - 1));
var parDdls = oneTierUpPnl.find('.DDLSelector' + (sectionNum - 1));
var parDdl = //How do I select the first element in the parDdls Set???
}
Upvotes: 0
Views: 56
Reputation: 15221
Use the :first
selector. Here's some documentation: http://api.jquery.com/first-selector/
You might use it like so:
function popagateDegreeUpwards(obj, sectionNum, compLev, counter)
{
var ddl = $(obj);
var oneTierUpPnl = ddl.parent('.Section' + (sectionNum - 1));
var parDdls = oneTierUpPnl.find('.DDLSelector' + (sectionNum - 1));
var parDdl = $(':first', parDdls);
}
You could also use the .first()
call. Docmentation here: http://api.jquery.com/first/
Usage example:
function popagateDegreeUpwards(obj, sectionNum, compLev, counter)
{
var ddl = $(obj);
var oneTierUpPnl = ddl.parent('.Section' + (sectionNum - 1));
var parDdls = oneTierUpPnl.find('.DDLSelector' + (sectionNum - 1));
var parDdl = parDdls.first();
}
Upvotes: 1