I am loading an html via ajax but the html contains a tinyMCE editor by calling wp_editor. The problem is I can't switch to different view like from Text to Visual view. I am also unable to Insert media into the editor due to the same javascript error problem. Here's the javascript error upon clicking the Visual View: https://www.dropbox.com/s/s031ewzlez9hepn/screenshot-1.png
I tried a different approach by converting the textarea into tinyMCE directly by instantiating the execCommand() after the HTML has been loaded but it doesn't look like the WP tinyMCE editor. See image: https://www.dropbox.com/s/2waoywdubgme8mh/screenshot-2.png