javascript - event propagation in IE -
in simple html page, below code,
<ul> <li id='testlist' style='border: 1px solid #2e2e2e;width:100px;height:100px;' onkeydown= "alert('kd');" onkeypress="alert('kp');" tabindex='0'> click me </li> </ul>
when press "enter" (with focus on li element), first "kd" pops , "kp" popups. infer onkeydown() executes first followed onkeypress(). means event propagation key down key press happens normally.
but in project, same code,this flow isn't happening. flow stops "kd".
what possible reasons event propagation stopping onkeydown() , not moving onkeypress()
my doubt possible ways achieve scenario. ie. stopping event propagation. 1 possibility got know "stoppropagation". haven't used in code anywhere. there other possibility achieve same.
these events not been propagated. 2 separated events.
keypress
1 event , keydown
event.
there no way stop propagating keypress
keydown
event (without custom code flags or else).
event propagation happens child element parent element. not 1 eventtype eventtype.
Comments
Post a Comment