Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Here is how to get the selected text with double click, </p> <h2>Update : now it also copies to last focused input.</h2> <p>First you need to set focus one of the inputs before double click the text.</p> <p>DEMO <a href="http://jsfiddle.net/yeyene/GYuBv/15/" rel="nofollow">http://jsfiddle.net/yeyene/GYuBv/15/</a></p> <pre><code>$(document).ready(function () { $("input[type=text]").focus(function(){ $("input[type=text]").removeClass('lastFocus'); $(this).addClass('lastFocus'); }); $('#myDiv').dblclick(function() { $('#selected').append(getSelectionText()); $("input[type=text].lastFocus").val($("input[type=text].lastFocus").val()+getSelectionText()); }); }); function getSelectionText() { var text = ""; if (window.getSelection) { text = window.getSelection().toString(); } else if (document.selection &amp;&amp; document.selection.type != "Control") { text = document.selection.createRange().text; } return text; } $.fn.insertAtCaret = function (myValue) { return this.each(function () { if (document.selection) { this.focus(); sel = document.selection.createRange(); sel.text = myValue; this.focus(); } else if (this.selectionStart || this.selectionStart == '0') { var startPos = this.selectionStart; var endPos = this.selectionEnd; var scrollTop = this.scrollTop; this.value = this.value.substring(0, startPos) + myValue + this.value.substring(endPos, this.value.length); this.focus(); this.selectionStart = startPos + myValue.length; this.selectionEnd = startPos + myValue.length; this.scrollTop = scrollTop; } else { this.value += myValue; this.focus(); } }); }; </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload