js and text select
i have a text field and in it the user can type data, including a hyperlink or the like, and i have a button that when clicked enters the <a> code right now it just looks like
textarea=textarea + "<A href=". and on a second click ">here</a>
i would like the user to simply be able to highlight the link and click the button.
dont how difficult this is, but if someone could just point me in the right direction, like how to send the selected test to a js function.