User tests: Successful: Unsuccessful:
Pull Request for Issue # .
Since #12561 Joomla has a set of (client side) methods to deal with the editors contents therefore creating javascript code for that is useless!
as explained in full in media/system/core.js:
// Only define the Joomla namespace if not defined.
Joomla = window.Joomla || {};
// Only define editors if not defined
Joomla.editors = Joomla.editors || {};
// An object to hold each editor instance on page, only define if not defined.
Joomla.editors.instances = Joomla.editors.instances || {
	/**
	 * *****************************************************************
	 * All Editors MUST register, per instance, the following callbacks:
	 * *****************************************************************
	 *
	 * getValue         Type  Function  Should return the complete data from the editor
	 *                                  Example: function () { return this.element.value; }
	 * setValue         Type  Function  Should replace the complete data of the editor
	 *                                  Example: function (text) { return this.element.value = text; }
	 * replaceSelection Type  Function  Should replace the selected text of the editor
	 *                                  If nothing selected, will insert the data at the cursor
	 *                                  Example: function (text) { return insertAtCursor(this.element, text); }
	 *
	 * USAGE (assuming that jform_articletext is the textarea id)
	 * {
	 *   To get the current editor value:
	 *      Joomla.editors.instances['jform_articletext'].getValue();
	 *   To set the current editor value:
	 *      Joomla.editors.instances['jform_articletext'].setValue('Joomla! rocks');
	 *   To replace(selection) or insert a value at  the current editor cursor:
	 *      replaceSelection: Joomla.editors.instances['jform_articletext'].replaceSelection('Joomla! rocks')
	 * }
	 *
	 * *********************************************************
	 * ANY INTERACTION WITH THE EDITORS SHOULD USE THE ABOVE API
	 * *********************************************************
	 *
	 * jInsertEditorText() @deprecated 4.0
	 */
	};For further examples please check the XTD-buttons!
Code review
| Status | New | ⇒ | Pending | 
| Category | ⇒ | Libraries | 
| Status | Pending | ⇒ | Closed | 
| Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2017-04-15 15:54:31 | 
| Closed_By | ⇒ | dgt41 | |
| Labels | Added: 
? | ||