Question

I'm really thrilled, because my code works great for me (se below), however I cannot use the arrow keys to move up/down in the list of results.

In the demo this feature is not available either, however I know it's enabled in the jQuery autocomplete, so I'm wondering if any of you have made it work for typeahead as well?

<input type="text" class="span3" style="margin: 0 auto;" data-provide="typeahead" data-items="13" data-source='[<?php
                $ii=0;
                while($row = mysql_fetch_array($resultatOrter)){
                    if($i!=0){
                        echo ',';
                    }
                echo '"'.$row['ortnamn'].'"';
                $i++;
            } ?>]'>
Was it helpful?

Solution

This issue has been reported here. It seems that they fixed it according to another issue and then broke it again in 2.04. This may not be the case, it's just a guess. I tried it in Firefox and it's broken for me as well as you said.

I would suggest finding a copy of 2.03 and see if that works. (you can probably look for an older revision on the bootstrap repository @ https://github.com/twbs/bootstrap

This mentions that they are aware and plan on fixing the issue in 2.1.0. And 2.03 should work.

OTHER TIPS

Check jQuery version. It works with jQuery 1.7.1

This issue still exists in 2.2.1, so I made the changes likestoski mentioned to solve the problem. I tried to upvote/comment on his answer, but I don't have enough reputation points.

This has been fixed in bootstrap 2.2.2

After using the suggestion by @Theo I dug around the 2.1 wip and found that if you modify the keyup handler in bootstrap.js to use the code from 2.1 wip (below) you will get your arrow up and down working again.

keyup: function (e) {
      switch(e.keyCode) {
        case 38: // up arrow
            e.preventDefault()
            this.prev()
            break

        case 40: // down arrow
            e.preventDefault()
            this.next()
            break
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top