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

Popular posts from this blog

python - Overriding the save method in Django ModelForm -

html - CSS autoheight, but fit content to height of div -

qt - How to prevent QAudioInput from automatically boosting the master volume to 100%? -