www.webdeveloper.com
Results 1 to 4 of 4

Thread: Parsing HTML Tags inside the Text Area

Hybrid View

  1. #1
    Join Date
    Nov 2013
    Posts
    2

    Question Parsing HTML Tags inside the Text Area

    Hi all,

    I am a newbie to JS.

    Currently i need to assign the value to the textarea while loading the page. As its the Div Element, when i am giving the URL in the textarea, it shows as link.
    Now I need to Print the Reference Value of that URL instead of a link.

    <script>
    window.onload=function()
    {
    var x=document.getElementById("text");
    var y = "Google Link";
    var z=y.link("www.google.com");
    x.value=z;
    }
    </script>

    Its printing the link as <a href="www.google.com">Google Link</a>
    Please help .

  2. #2
    Join Date
    Mar 2009
    Posts
    501
    Are you trying to put an active hyperlink into a textarea element? If so, I don't think this is possible. What you can do however is put the link into an element such as a div such as:

    <div contenteditable="true">

    which can be used with proper care as a substitute for a textarea element.

  3. #3
    Join Date
    Nov 2013
    Posts
    2
    Thanks Tcobb.

    div Contenteditabe is true. and i am able to print the url in TextArea as URL.

    But i need the Reference Name to be Shown instead of URL as the hyperlink.


    working Perfectly and shows the URL.

    <script>
    window.onload=function()
    {
    var x=document.getElementById("text");
    x.value="www.google.com";
    }
    </script>
    Instead of www.google.com I need "Google Link" to be printed as the reference Name.

    Pls Help

  4. #4
    Join Date
    Mar 2009
    Posts
    501
    Once again, I'm not entirely sure what you want to be doing here. Why can't you just have:

    Code:
    <div id="text" contenteditable="true">
    <a href="http://www.google.com">Google Link</a>
    [whatever]
    </div>
    in your HTML?

    Or does the link need to be added dynamically?

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles