I apologize if this has been answered here before, but I've searched and I'm not finding what I need. I'm creating a select box and populating the options with the name of a congressional bill and the option id with the bill number. Once the bill is selected, I need to fire off an even that will pass the id to a function. I can't figure out how to do that last part. I can add .click to the select element, but that takes the id of the first option, not the option that was picked. I can't get .click to work on the option itself. I've also tried using .focus and .select on the option element, but they aren't working either. How can I get jquery to recognize the option I've chosen? Any suggestions?
$.each(response.objects, function(){
billNum = response.objects[count].id;
$('#billSelector').append('<option id=\''+billNum + '\'>' +response.objects[count].title + '</option>');
count++;
});//each
$('option').focus(function(){
alert($('option').attr('id'));
});//function