Link to home
Start Free TrialLog in
Avatar of smrlnarisetty
smrlnarisetty

asked on

how do I insert html in textarea

Hi,

My requirement is to insert HTML text in a textarea in one form[it could contain <a href...>cc</a>....<b>..</b> etc] and to be able parse the HTML and show the links in another textarea..in another form...so that the user can click the links...

How do I achieve this..

Thanks
Ram.
ASKER CERTIFIED SOLUTION
Avatar of apresto
apresto
Flag of Italy image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of smrlnarisetty
smrlnarisetty

ASKER

it displays fonts and bold letters ..but i need clickable links in it ?
https://www.experts-exchange.com/questions/11827220/Embed-an-actual-Href-within-a-textarea-within-a-form.html

i got the answer from the above:

<script>
/* Links script
   (c) 2000 Michel Plungjan michel@irt.org */
function translate() {
   text = document.myForm.myArea.value

   newText = "";
   if (text.indexOf('link:') !=-1) {
      myLinks = text.split('link:')
      for (i=0;i<myLinks.length;i++) {
         if (myLinks[i]) newText += myLinks[i] +
         '\n<a href="' + prompt('href for >'+myLinks[i]+'< ?','href="http://">http://') + '">' + prompt('text for >'+myLinks[i]+'< ?',myLinks[i])+'</a>';
      }
      text = newText;
   }
   else newText = text;
   alert(text);
}

</script>

Dont ask me what it means, i thought it might help
SOLUTION
Avatar of nurbek
nurbek

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
grade C, what did we do wrong? oh well, thanks anyway for the points :o)