Greg Gum Greg Gum - 7 months ago 25
Javascript Question

What does 'data()' do in '$("#myWidget").data(`ejTE`)'

This works:

var editor = $("#htmlEditor").data('ejRTE');

The question is what does

It retrieves the widget which is part of this html:

<textarea id="htmlEditor" value.bind="entity.content"
style="height: 220px"></textarea>

How do I retrieve it without jQuery.

Answer Store arbitrary data associated with the specified element and/or return the value that was set.

So basically the widget stores some data in the element htmlEditor indexed ejRTE, I bet it is a custom object used by this tool.

var editor = $("#htmlEditor").data('ejRTE');

then editor will hold the object stored by the widget for this element