Reset medium editor textarea

Trying to reset, or clear as it were, a medium text area on submission. There’s no option for it in the UI, and trying a .reset() does not work either.

I’ve searched the forum and see some similar issues with summer note that were solved, but the same fixes does not seem to work for Medium unfortunately.

Anyone have any ideas on how to force a reset?

You can set its value to an empty string, there’s no a reset method available.

1 Like

Thanks @Teodor.

The UI for setting the value doesn’t allow for an empty value, so what I’ve done is creating a var with no value, and then setting the medium value to the empty var’s value. Is that what you had in mind, not sure if there’s a better way to achieve that?

It seems to do the trick at least :slight_smile:

You can just edit this in code and set '' as a value.

I tried that at first, but it results in a weird behaviour where the text marker in the input jumps to 0,0 and if you start typing after the form success (without first clicking inside the textarea) a line break will be inserted below the first text row. Not sure what’s up with that, but feeding it the var’s empty value does not result in that behaviour.

If you want to reproduce it.

This is the textArea

<textarea id="editor_new_note" is="dmx-medium-editor" style="border-radius: 5px; width: 100%; outline: none !important; padding: 15px; font-size: 13px; overflow: scroll; height: 110px;" placeholder="" buttons="bold,italic,underline,strikethrough,orderedlist,unorderedlist,removeFormat" auto-link="true" auto-list="true" target-blank="true" align="left" fontawesome="true" name="description" required="" data-msg-required="" disable-extra-spaces="true"></textarea>

on form success
editor_new_note.setValue('')