I know this question has been asked many times, but in different forms. I want to access the selected
variable elsewhere within the scope of the topmost function (alert
is currently returning undefined). I know I need to use a return
in some way or another. Thank you in advance.
$('#people_search_mobile').change(function() {
var selected;
$('li a', $('#suggestions')).bind('click.autocomplete',function(){
selected = ($(this).text());
});
alert(selected);
}