vuju
vuju

Reputation: 11

search engine like google search

am trying to do search engine same like google search using html ajax and jsp

1.When i hit a character in my text box it calls ajax for every hit

2.ajax redirects it to jsp where i have a simple query which fetches employee names from employee table.and stores it in result set.

3.through this result set am displaying emp names in combo box, onchange in combo box it display in my text box . My problem is am not able to take event.keycode value from combo box because keycode only works in keyup and keydown and this is not available in combo box option.

Upvotes: 1

Views: 2857

Answers (2)

Jim Mitchener
Jim Mitchener

Reputation: 9003

I assume by combobox you mean a <select> with multiple set. You will not be able to do this as there are no key-based events associated with those elements.

What you will want to do is use a standard text <input> field and display a div directly under it with the search results. This is how auto-complete is almost always done. You can see a great example in the jQuery Autocomplete page.

You can always implement this yourself, but I would highly recommend off-loading this Javascript code to jQuery. It's already been done for you.

Upvotes: 2

Nikita Barsukov
Nikita Barsukov

Reputation: 2984

JQuery plugin autocomplete handles such things pretty well from client side.

Upvotes: 1

Related Questions