Insert into textarea | JavaScript

Posted by Wayne on Stack Overflow See other posts from Stack Overflow or by Wayne
Published on 2010-05-26T21:50:58Z Indexed on 2010/05/26 22:01 UTC
Read the original article Hit count: 191

Filed under:
|
|

I'm trying to insert the image url where the point of the is to be when editing the textarea value.

function addImageURL()
{
 var imageurl = prompt("Enter image URL", "Your name")
 var post = document.getElementById("message-put").value;

 document.getElementById('message-put').value = post + '[img]' + imageurl + '[/img]';
}

This code grabs the value inside the adds the image url next to it which I don't want, I need it to insert it where the point was when editing the textarea

Thanks

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about dom