Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    ubh
    ubh is offline
    Regular Coder ubh's Avatar
    Join Date
    Apr 2008
    Location
    Portland, Oregon U.S.A.
    Posts
    443
    Thanks
    108
    Thanked 15 Times in 14 Posts

    replace(string) over createTextNode???

    Currently I am pulling the innerHTML of a textarea and attaching it to a createTextNode and appending it to a div box called pallet.

    however when I append the createTextNode to my pallet div box the createTextNode turns the innerHTML < and > characters into &lt; and &gt; so my question is how do I run a replace(/&gt;/g,">")... over a createTextNode before appending it to my pallet div box??

  • #2
    Banned
    Join Date
    May 2006
    Location
    England
    Posts
    664
    Thanks
    0
    Thanked 84 Times in 84 Posts
    Quote Originally Posted by ubh View Post
    Currently I am pulling the innerHTML of a textarea and attaching it to a createTextNode and appending it to a div box called pallet.

    however when I append the createTextNode to my pallet div box the createTextNode turns the innerHTML < and > characters into &lt; and &gt; so my question is how do I run a replace(/&gt;/g,">")... over a createTextNode before appending it to my pallet div box??
    Presumably there's a reason it has to be .innerHTML and not .value.
    Not tested but something like:
    Code:
    myDiv.appendChild(document.createTextNode(myTextarea.innerHTML.replace(/&lt;/ig,"<").replace(/&gt;/ig,">")));


  •  

    Posting Permissions

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