I'm a coding a JavaScript reporting component, that requires multiple LI's i.e. lists to be selected collectively as a bunch with visual feedback.
I'm thinking of adapting the onfocus
event. Is it possible for multiple HTML elements to receive focus at the same time?
Not inputs, but DIVs, so I don't need the cursor. I just want several DIVs to be "selected" separately from others, colored differently to simulate multiple item selection.
The following elements can receive focus: <a> tags with an href attribute. Form controls and buttons (unless the element is disabled) Any element with a tabindex .
The HTML class attribute is used to specify a class for an HTML element. Multiple HTML elements can share the same class.
The id must be unique. There can be only one element in the document with the given id . If there are multiple elements with the same id , then the behavior of methods that use it is unpredictable, e.g. document. getElementById may return any of such elements at random.
The HTMLElement. focus() method sets focus on the specified element, if it can be focused. The focused element is the element that will receive keyboard and similar events by default.
No, you can only focus on one element at a time.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With