I want to append text inside Textarea. The text should be appended immediate after the cursor position and not at the end.
Here is my code:
The HTML:
<html>
<开发者_高级运维;head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
</head>
<body>
<textarea id="textarea1"></textarea>
<br><input type="button" value="Write blah blah" onclick="addtxt('textarea1')">
</body>
</html>
The Script:
<script>
function addtxt(input) {
var obj=document.getElementById(input);
obj.value+="blah test 123"
}
</script>
The above code is live at: http://jsfiddle.net/zGrkF/
Thanks in advance..
Try jQuery.
With that the code is the following:
$("#textarea1").hover(
    function()
    {
        $(this).value('IN');
    },
    function()
    {
        $(this).value('OUT');
    });
OR
$("#textarea1").mouseover(
    function()
    {
        $(this).value('IN');
    });
UPDATED:
Try this link
The jQuery Field Selection plugin is quite old but should enable you to do everything you want and more.
 
         
                                         
                                         
                                         
                                        ![Interactive visualization of a graph in python [closed]](https://www.devze.com/res/2023/04-10/09/92d32fe8c0d22fb96bd6f6e8b7d1f457.gif) 
                                         
                                         
                                         
                                         加载中,请稍侯......
 加载中,请稍侯......
      
精彩评论