Facebook
From Sexy Dormouse, 10 Months ago, written in JavaScript.
Embed
Download Paste or View Raw
Hits: 107
  1. $("#emojis span").on("click", function () {
  2.   var caretPos = $("#input")[0].selectionStart;
  3.   var textAreaTxt = $("#input").val();
  4.   var txtToAdd = $(this).text();
  5.   $("#input").val(
  6.     textAreaTxt.substring(0, caretPos) +
  7.       txtToAdd +
  8.       textAreaTxt.substring(caretPos)
  9.   );
  10.   $("#input").get(0).setSelectionRange(caretPos, caretPos);
  11. });
  12.  

Replies to Untitled rss

Title Name Language When
Re: Untitled czet(...).setSelectionRange isxc javascript 4 Months ago.