onKeyPress problem

Discussion in 'JavaScript' started by jj0914, Aug 28, 2007.

  1. #1
    When I use onKeyPress event handler for my select box, it gives me weird behaviour, e.g if i choose #72 item, it actually gives me next item #73, if i choose #73, it gives me #74. I am not sure why.

    here is the snippet of my code:
    
    <select id="children_of_category_[% Pid %]" onClick="getSub(this.id)" onKeyPress="getSub(this.id)">
    
    Code (markup):
    Thanks in advance
     
    jj0914, Aug 28, 2007 IP
  2. garazy

    garazy Peon

    Messages:
    35
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Does it always occur in that order? It sounds like you are a 'click behind' which may be what occurs with OnKeyPress

    Try using onkeydown or onkeyup instead. onkeyup might have more luck.
     
    garazy, Aug 31, 2007 IP