What happens when the element that has focus is deleted (or becomes hidden)? Elements and actions that led to the deletion may be different. You need to continue to monitor keyboard events after removing the focused item. How to do it? I tried to hang an onkeydown handler on <body> or <html> , but no events come. Or can you somehow do it so that after removing an element, the focus is transferred to another existing element? Enough only for browsers that support HTML5 / CSS3.

    1 answer 1

    Well, if you hide an element with the string el.style.display='none' , then why not write other_element.focus()

    focus

    • It is clear that there is a focus function. But I have a lot of different elements and actions with them. It is clear that it is possible to add focus to each handler (where we now hide the element with the last line). But then elements with similar logic will be added more. - angry