Insert selected text on the page into textarea (jQuery) -
There is a need to have some buttons to do the selected text on the page in texterrari.
jQuery (function () {// bind your page jQuery ('# some button ') Click the click handler of some buttons (function (evt) {// select text in a given text textarea = jQuery (' textarea # someTextArea '); textarea.val (Textarea.val () + getSelectedText () ); Evt.preventDefault ();});}); // Get User Select Text on Page FunctionShackedtext () {if (window.getSelection) {return window.getSelection (); } And if (document.) {Return document. Selection. Range (). Text; } Return ''; }
Comments
Post a Comment