[jQuery] Re: Selecting a value with up down keys

2010-01-12 Thread m.sirin
Hi, I used your code but still it's the same problem: If the box appears the up and down keys will do nothing. It would be nice, if you take a quick look at http://igf-project.igf.uos.de/~bhempen/index_tomaten.html where you can see the problem. regards m.sirin On 11 Jan., 01:27, Šime Vidas wrot

[jQuery] Re: Selecting a value with up down keys

2010-01-10 Thread Šime Vidas
Actually, this is right... $().keydown(function(e) { var $item = $(".selected"); if (e.keyCode === 40) { // bottom if ($item.next().is("li")) { $item.removeClass("selected").next ().addClass("selected");

[jQuery] Re: Selecting a value with up down keys

2010-01-10 Thread Šime Vidas
The code above is wrong... here: $().keydown(function(e) { var $item = $(".selected").removeClass("selected"); if (e.keyCode === 40) { // bottom if ($item.next().is("li")) { $item.next().addClass("selected");

[jQuery] Re: Selecting a value with up down keys

2010-01-09 Thread m.sirin
the html section looks like: Hi1 Hi2 Hi3 and then I added Sime Vidas code: $(document).ready(function() { $("#autoSuggestionsList :first").addClass("selected"); $().keydown(function(

[jQuery] Re: Selecting a value with up down keys

2010-01-09 Thread m.sirin
Okay, thank you. But I dont know how to iterate through the values of #autoSuggestionsList. They are like Hello1 Hello2 Like this? if (#autoSuggestionsList.next().is("li")) { '#autoSuggestionsList.next().addClass ("selected"); ...

[jQuery] Re: Selecting a value with up down keys

2010-01-09 Thread Šime Vidas
I forgot to mention: don't get freaked out by the code... basically what you need is: $().keydown(function(e) { if (e.keyCode === 40) { // down cursor key was pressed } else if (e.keyCode === 38) { // up cursor key was pre

[jQuery] Re: Selecting a value with up down keys

2010-01-09 Thread Šime Vidas
Here ... http://vidasp.net/jquery-example8.html