You either:
a. Have a bad keyboard,
b. Have some external code from some library or somewhere else in your page or application that is catching a d keypress and preventing the event from bubbling.
So,
It certainly has nothing to do with the code you posted (see zerkms' comment), and
If you want it resolved, you will either have to post more code, or start debugging the code we cannot see. Do a process of elemination. Delete everything else in your page. Does it still not work? Play around. You won't get any more insight here with what you have posted.