Welcome aboard! We are happy you are here and wish you good net-raft!
<!doctype html>
<html lang="en">
<head>
<script src="https://code.jquery.com/jquery-1.10.2.js"></script>
</head>
<body>
<button>CLICK</button></p>
<textarea id="mytextarea" cols="30" rows="10">some text</textarea>
<script>
$(document).ready(function () {
$("button").click(function () {
var x = "your text";
var $txt = $("#mytextarea");
var caretPos = $txt[0].selectionStart;
var textAreaTxt = $txt.val();
var txtToAdd = x;
$txt.val(textAreaTxt.substring(0, caretPos) + txtToAdd + textAreaTxt.substring(caretPos));
});
});
</script>
</body>
</html>
The most helpful JAVASCRIPT solutions
How can I get the last day and the next day in javascript ?JAVASCRIPT Click to see more ... 5.8K 507