Differences
This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision Next revisionBoth sides next revision | ||
devwiki:html [2021/08/28 07:37] – [css file not loading] ying | devwiki:html [2021/12/20 07:19] – [html select dropdown and remove focus] ying | ||
---|---|---|---|
Line 192: | Line 192: | ||
} | } | ||
} | } | ||
+ | </ | ||
+ | |||
+ | ===== html select dropdown and remove focus ===== | ||
+ | * problem: when select dropdown, the select focus still stuck on the dropdown list, (when you press arrow key) | ||
+ | * solution: to remove focus after choose, add onchange event and remove its focus <code javascript> | ||
+ | const choice_input = document.querySelector(" | ||
+ | choice_input.onchange = function(event){ | ||
+ | choice_input.blur() // remove focus from this input | ||
+ | } | ||
+ | // also if you have onload function, you can add this to onload to reset last choice when refresh browser | ||
+ | const tmp_choice_input= document.querySelector(" | ||
+ | tmp_choice_input.selectedIndex = " | ||
</ | </ |