Reputation: 57
I would like to know, via javascript, which give a form element has the focus()
, to be able to switch to a variable that holds the name of the currently active.
But without using frameworks like jQuery
.
And without the use onfocus event
within each component of the form.
Is that possible?
M.
Upvotes: 0
Views: 46
Reputation: 805
try this code,
document.formname.activeElement
As seen in this answer.
Upvotes: 0