How to Change a div from an ACE Editor back to a div

ace-editor, javascript

Solution

`editor.destroy` doesn't remove all event listeners from div, so one have to do something like this.

var value = editor.getValue()
editor.destroy()
var oldDiv = editor.container
var newDiv = oldDiv.cloneNode(false)
newDiv.textContent = value
oldDiv.parentNode.replaceChild(newDiv, oldDiv)

Problem

I know that you can turn a div into an ACE editor like so: ``` var editor = ace.edit("editor"); ``` How does one change this back into a normal div?

Original source