Page 1 of 1

Onclick sending href volume to textarea?

Posted: Wed Aug 15, 2012 9:07 pm
by Jaami
Ok, this should be something real easy, but i tried all kinda stuff and still cant manage to make it right.. :oops:

So i want to click on a link and send the volume of it to a textarea.

See:
31044045023.jpg

Re: Onclick sending href volume to textarea?

Posted: Thu Aug 16, 2012 7:23 pm
by Helx
...

So you want to go to that link, and have the box 'selected' ?

Re: Onclick sending href volume to textarea?

Posted: Thu Aug 16, 2012 8:26 pm
by Jaami
When i hover over a comment it shows me the link in the bottom left(i managed to do that already...). And when i click on the comment it sends the link to the textarea. The screenshot shows where i want to have the link of the comment...

101300014712124.jpg

Re: Onclick sending href volume to textarea?

Posted: Fri Aug 17, 2012 9:11 pm
by jacek
If your <a> tag has the id of "link" and the <textarea> "area" then you can do this.

[syntax=javascript]document.getElementById('link').addEventListener('click', function(event){
event.preventDefault();

// this will get you the link.
alert(this.href);

// this will add it to the textarea
document.getElementById('area').appendChild(document.createTextNode(this.href));
}, false);[/syntax]
Hopefully anyway :P