javascript - Keyup event is not firing while click shift+tab -


keyup event not firing while click shift+tab first element.

for example:

<a href="javascript:;" id="btn" tabindex="1">tools</a> 

here m writing keyup event in javascript. if m clicking shift+tab while first element having focus, not working.so how sort out issue.

fiddle

what's happening:

  • you keydown on 2nd field, focus change 1st field
  • you keyup on 1st field
  • you keydown on 1st field, focus change sub-window/elements outside of original <body> listener attached
  • you keyup there , event not captured

if want capture event, try put can focused before 1st field, within <body>. suspect there better solutions, without knowing context, that's best suggestion can offer.

see modified jsfiddle.


Comments