Thanks, Ryan! Rick
> -----Original Message----- > From: jquery-en@googlegroups.com [mailto:jquery...@googlegroups.com] On > Behalf Of Ryan > Sent: Monday, February 09, 2009 1:49 PM > To: jQuery (English) > Subject: [jQuery] Re: Can I use a reference to a select id in a function like > this? > > > Yep, you have the right idea. I would do this: > $(function(){ > $('#agentSelect').change(function(){ > var element = $('option:selected',this); > // do whatever you need to do with the element > console.debug(element.val()); > }); > }); > > On Feb 9, 12:48 pm, "Rick Faircloth" <r...@whitestonemedia.com> wrote: > > I have a select with id="agentSelect" and onchange="updateDutyRecord()". > > Once I choose > > an option, can I reference the select and option like this? > > > > function updateDutyRecord() { > > > > $('#agentSelect', this).change(function() { > > > > $('option:selected', this).each(function() {