/    Sign up×
Community /Pin to ProfileBookmark

Determining next focus element within onblur event

I have created some HTML combo boxes (not the plain <SELECT> kind but full featured with type in search capabilities and more using textbox, select, and button intrinsic HTML controls). I would like the user to be able to navigate from one of these combo boxes to another or other controls on the web page. As one of the combo boxes loses focus, I would like the combo box that is losing focus (i.e. the combination of HTML textbox, select, and button) to just display the textbox but only if the user navigates outside of current combo box combination of controls. I first thought of surrounding each combo box combination of controls in a DIV container but the DIV tag does not support onblur or onfocus events. (It does but if you are currently focused on an HTML control within the DIV container and then click on a control within another DIV container, the DIV’s onblur event does not get triggered). So I was left with each control’s onblur to judge the lost focus but I didn’t know how to judge the next control about to gain focus. If the control about to gain focus is part of the current combo box combination of controls, then I want to keep the display of those controls. However, if the control about to gain focus is outside the current combo box’s combination of controls, then showing only the textbox is appropriate. TIA.

dlausch

to post a comment
JavaScript

0Be the first to comment 😎

×

Success!

Help @dlausch spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.5,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,

tipper: @Samric24,
tipped: article
amount: 1000 SATS,
)...