Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to set a text value for document.activeElement?

Knowing that my document.activeElement is an input field (I don't know exactly the name of the component, but may be the Google's search input field, for example), how can I set a text on it programmatically?

--update

I'm trying it from a xul application, via javascript after the page is loaded. A paste command works fine, so I know the field have the focus. (and I didn't put the Xul tag becouse it's just about the javascript)

like image 655
The Student Avatar asked Sep 20 '25 04:09

The Student


1 Answers

See the mozilla reference. This is the same type as document.getElementById()

document.activeElement.value = 'new value';
like image 78
Josiah Ruddell Avatar answered Sep 21 '25 21:09

Josiah Ruddell