Hi.
I've got a problem with a javascript I've created.
The script lets me write predefined text with a simple link. The problem is that the text written by the function writes the output to the end of the textarea. I want it to write exactly where the cursor is at the moment in that textarea. Is this possible at all with javascript?
Here's the code:
Code:
<html>
<head>
<script>
function Insert_Code(areaName,tag){
var Area = document.getElementById(areaName)
Area.innerText+=tag
}
</script>
</head>
<body>
<a onclick="Insert_Code('Test','<p>\n</p>')">Test<a><p>
<textarea id="Test"></textarea>
</body>
</html>
Hope someone knows how to do this.
Anders