Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 32187
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 10, 20262026-05-10T13:43:23+00:00 2026-05-10T13:43:23+00:00

I have a custom built ajax [div] based dynamic dropdown. I have an [input]

  • 0

I have a custom built ajax [div] based dynamic dropdown.

I have an [input] box which; onkeyup, runs an Ajax search which returns results in divs and are drawn back in using innerHTML. These divs all have highlights onmouseover so, a typical successful search yields the following structure (pardon the semi-code):

[input]  [div id=results] //this gets overwritten contantly by my AJAX function   [div id=result1 onmouseover=highlight onclick=input.value=result1]   [div id=result2 onmouseover=highlight onclick=input.value=result2]   [div id=result2 onmouseover=highlight onclick=input.value=result2]  [/div] 

It works.

However, I’m missing the important functions behind regular HTML elements. I can’t keyboard down or up between ‘options’.

I know javascript handles keyboard events but; I haven’t been able to find a good guide. (Of course, the follow-up question will end up being: can I use <ENTER> to trigger that onclick event?)

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-10T13:43:23+00:00Added an answer on May 10, 2026 at 1:43 pm

    What you need to do is attach event listeners to the div with id='results'. You can do this by adding onkeyup, onkeydown, etc. attributes to the div when you create it or you can attach these using JavaScript.

    My recommendation would be that you use an AJAX library like YUI, jQuery, Prototype, etc. for two reasons:

    1. It sounds like you are trying to create an Auto Complete control which is something most AJAX libaries should provide. If you can use an existing component you’ll save yourself a lot of time.
    2. Even if you don’t want to use the control provided by a library, all libraries provide event libraries that help to hide the differences between the event APIs provided by different browsers.

    Forget addEvent, use Yahoo!’s Event Utility provides a good summary of what an event library should provide for you. I’m pretty sure that the event libraries provided by jQuery, Prototype, et. al. provide similar features.

    If that article goes over your head have a look at this documentation first and then re-read the original article (I found the article made much more sense after I’d used the event library).

    A couple of other things:

    • Using JavaScript gives you much more control than writing onkeyup etc. attributes into your HTML. Unless you want to do something really simple I would use JavaScript.
    • If you write your own code to handle keyboard events a good key code reference is really handy.
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 144k
  • Answers 144k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Yes, you can install the database on a SQL Server… May 12, 2026 at 8:42 am
  • Editorial Team
    Editorial Team added an answer Change all the links to the page with a nonsense… May 12, 2026 at 8:42 am
  • Editorial Team
    Editorial Team added an answer You could determine the UserControl name by parsing it out… May 12, 2026 at 8:42 am

Related Questions

I have a current system which is build as a Windows Application, and does
I'm a big fan of keeping application logic in the servlet, and keeping the
Here's the problem I'm having, I've got a set of logs that can grow
Can anyone recommend a GUI builder tool for creating DHTML web apps using AJAX

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.