Page 1 of 1

Get element value with javascript

Posted: Tue Jan 25, 2022 5:32 pm
by NicoAMP
Hello,

In my custom framework, with javascript, I would like to get attibute value of a specific element of my opened XHTML document.
How can I do that?

Thanks a lot.

Re: Get element value with javascript

Posted: Wed Jan 26, 2022 3:15 pm
by mihai_coanda
Hello,
To get an attribute of a node you will need to obtain a reference to an XML element[1] js instance which has a getAttribute(name) method.
You can obtain such an instance from a Selection [2] instance which in turn can be obtained from a SelectionManager[3] instance.
The SelectionManager instance can be obtained from an EditingSupport[3] instance.
You can obtain an EditingSupport instance using the sync.api.Editor.getEditingSupport [4] method.
An instance of the Editor class can be obtained by listening on the EDITOR_LOADED event whose listener is called with an instance of Workspace.EditorLifecycleEvent.[5].

Best Regards,
Michael

1. https://www.oxygenxml.com/maven/com/oxy ... ement.html
2. https://www.oxygenxml.com/maven/com/oxy ... et__anchor
3. https://www.oxygenxml.com/maven/com/oxy ... er__anchor
4. https://www.oxygenxml.com/maven/com/oxy ... rt__anchor
5. https://www.oxygenxml.com/maven/com/oxy ... Event.html

Re: Get element value with javascript

Posted: Fri Feb 25, 2022 4:31 pm
by NicoAMP
Hi Michael,
Thanks a lot for these informations.
Regards,
Nicolas