views:

807

answers:

2

http://community.sciencecareers.org/mt-static/plugins/CommunityPlus/js/autocomplete/ http://community.sciencecareers.org/mt-static/plugins/CommunityPlus/js/autocomplete/demo/

Trying to programmatically trigger the display of the autocompletion list results. This, instead of waiting for user input.

Is this doable? (I've tried getting the element's focus, calling a Javascript down-arrow key event. No dice)

+1  A: 

If, and only if, you are using a version of jQuery 1.3 or greater, you can create a jQuery.Event object, then trigger() it. I was only able to get it to work if the element is also focused. So this code works for the "E-Mail (local):" example on the demo page.

var e = jQuery.Event("keydown");
e.which = 40;
$('#suggest13').trigger('focus').attr('value',' ').trigger(e);

I'm not sure exactly what your situation is, I think it's somewhat dependent on the autocomplete actually showing something if only a space is pressed. That's not always the case.

artlung
Yeah, I had already come across that. Thanks all the same! Unfortunately I'm stuck with jQuery 1.2.6 for the time being.
Aaron F.
A: 

Aaron - if you're working on the site that you posted in your question, you should recognize me. Please send me an email message or call me telling me what you're attempting to do with the site you listed, I can help out.

Thanks for the invite, but I'm not a developer for community.sciencecareers.org
Aaron F.