The SitePoint Forums have moved.

You can now find them here.
This forum is now closed to new posts, but you can browse existing content.
You can find out more information about the move and how to open a new account (if necessary) here.
If you get stuck you can get support by emailing forums@sitepoint.com

If this is your first visit, be sure to
check out the FAQ by clicking the
link above. You may have to register
before you can post: click the register link above to proceed. To start viewing messages,
select the forum that you want to visit from the selection below.

Hybrid View

onClick in <select>

Hi:

I know there is no onClick event in <select>. I was wondering if there is a way to do that.

What I have right now, is a text box. When somebody enters some text in this text box, a <SELECT> box is fetched with AJAX (with size=20). When user presses DOWN key in the text box (keyCode=40), it selects the first element of thist <select> box.

It works up until the step above. But, when it selects the first element, <SELECT> box disappears ( that's how it works) because onChange event fires for that <SELECT> box.

What I want is that this <SELECT> box does NOT DISappear UNTIL user presses ENTER (working) OR user CLICKS in this select box.

I saw many examples on autocomplete fields, but they all take data from a javascript file.

I am not much experienced in Javascript that I can change that to fit what I want.

What I do is, I call a page with AJAX which can return the data in any format I need. So, if anyone can help me to modify one of these in a way that these scripts take data from a server-side page then that'd mostly helpful.