...

View Full Version : replace(string) over createTextNode???



ubh
09-01-2008, 02:19 AM
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??

Arty Effem
09-01-2008, 03:35 AM
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:
myDiv.appendChild(document.createTextNode(myTextarea.innerHTML.replace(/&lt;/ig,"<").replace(/&gt;/ig,">")));



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum