Hi All,
I have the following widget template:
template:
'<div class="testwidget">' +
'<div class="testwidget-title">$title</div>' +
'<div class="testwidget-desc">$description</div>' +
'<div id="config">' +
'</div>' +
'</div>',
button: 'Create a test widget',
In the data method I want to append an input element something like the following
<input type="hidden" id="tag" value="test">
data: function() {
var ele = editor.document.createElement( 'input' );
ele.setAttribute('type', 'hidden');
ele.setAttribute('id', 'tag');
ele.setAttribute('value', this.data.tag);
var configObj = this.element.find('div#config');
configObj.append(ele);
The above code retrieves the configObj correctly, but is unable to append the input element to config div. The last line throws an error
Uncaught TypeError: undefined is not a function
How can I append html to widget content dynamically?
Thanks
Ashy