Hi,
We've initialised a TextArea using the following code:
$("#textArea").kendoTextArea({
label: "Label",
rows: 4,
maxLength: 1000
});
And try to clear it using the following code:
const textArea = $("#textArea").kendoTextArea().data("kendoTextArea");
textArea.value("");
textArea.trigger("change");
It works but it looks like it resets any configuration you set like rows and maxLength and adds extra markup.
Here's the markup before the clear:
<span class="k-input k-textarea k-input-solid k-input-md k-rounded-md k-resize-none" style=""><textarea id="textbox-notes" data-role="textarea" aria-disabled="false" maxlength="1000" rows="4" class="!k-overflow-y-auto k-input-inner" autocomplete="off" style="width: 100%; resize: none;"></textarea></span>
And after:
<span class="k-input k-textarea k-input-solid k-input-md k-rounded-md k-resize-none" style=""><span class="k-input k-textarea !k-overflow-y-auto k-input-inner k-input-solid k-input-md k-rounded-md k-resize-none" style="width: 100%; resize: none;"><textarea id="textbox-notes" data-role="textarea" aria-disabled="false" rows="1" class="!k-overflow-y-auto k-input-inner" autocomplete="off" style="width: 100%; resize: none;"></textarea></span></span>
Note the rows have reset to 1 and maxlength is missing. Also, there is an extra SPAN around the original SPAN and TEXTAREA. We tried setting the properties manually after the change trigger using:
$("#textArea").prop("rows", "4");
$("#textArea").prop("maxlength", "1000");
This works okay but obviously doesn't fix the extra markup.
Is this the correct way to clear a TextArea? Or do we just reset the value in jQuery directly?
Thanks