Closed bzuidgeest closed 5 months ago
You can do something like:
const target = document.getElementById('jsoneditor')
const editor = new JSONEditor({ target, ... })
target.editor = editor
Ah, I forget how flexible the dom/javascript seems to be, I can attach the editor to the target myself.
Thanks for the quick answer.
Yes. This flexibility also makes it easy to create a mess for yourself, be careful 😅 .
I'm already learning/switching to typescript to be more carefull. It's also why I asked if such a property already existed. I will keep it in mind.
This might be an obvious thing for most javascript programmers, but I'm mostly into c#. So here goes.
Is it possible to retrieve the editor instance object by means of the editor target element?
Consider the example below. There is the div "jsoneditor" and there is the const jsoneditor with an instance of the editor that also points to the target div.
Is there a way to do for example something like:
document.getElementById('jsoneditor').jsoneditorInstanceOnThisElement.Updateprops(.......), etc
This would be usefull as that way I can always get a reference to the correct instance for specific element if I have multiple editors on a single page.