* Footnote button for the Classic Editor text mode.
*
* @since 1.3.0
* @lastmodified 2021-02-18T2043+0100
*
* @since 2.5.4 Bugfix: Editor button: Classic Editor text mode: try to fix uncaught reference error of “QTags is not defined”, thanks to @dpartridge bug report.
* @since 2.5.4 Bugfix: Editor button: Classic Editor text mode: correct label to singular.
*/?>
-->
<scripttype="text/javascript">
/**
* Brackets the selected text with tags in the text area.
*
* @param string elementID
* @param string openTag
* @param string closeTag
*/
function MCI_Footnotes_wrapText(elementID, openTag, closeTag) {
var textArea = jQuery('#' + elementID);
var len = textArea.val().length;
var start = textArea[0].selectionStart;
var end = textArea[0].selectionEnd;
var selectedText = textArea.val().substring(start, end);
var replacement = openTag + selectedText + closeTag;