I'd suggest to embed the list of names for each character in a div with the appropriate id
, such as for the names starting with S:
<div id="S">
... names with S ...
</div>
Then you can use jQuery to react on a keypress, and just do a
location.href = '#S';
Then, the browser will automatically scroll to the appropriate div
. Another advantage of this is that you can even use the URL to put it into your favorites, so if you want to jump directly to all people with S, you can do this easily.
Update: As the .keypress()
function of jQuery only returns a number, not the character itself, you need to convert it. See Convert character to ASCII code in Javascript for an example of how to convert a character to a number and vice-versa.