Raw HTML

Need raw HTML data into a string

Page 1 of 1

2 Replies - 2091 Views - Last Post: 04 April 2010 - 10:22 AM

#1 jim2854  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 7
  • Joined: 10-December 09

Raw HTML

Posted 04 April 2010 - 07:44 AM

I need to put the raw unformatted HTML data into a string.

I have tried: document.body.innerHTML but this formats the HTML before it returns it. Any help would be much appreciated.
Is This A Good Question/Topic? 0
  • +

Replies To: Raw HTML

#2 Martyr2  Icon User is offline

  • Programming Theoretician
  • member icon

Reputation: 3873
  • View blog
  • Posts: 11,412
  • Joined: 18-April 07

Re: Raw HTML

Posted 04 April 2010 - 09:43 AM

innerHTML is used to insert formatted HTML and is rendered. innerText does not. However, some browsers will not recognize innerText for any/all elements so you may want to either look for other properties of the element to see if it has something like ".value" if you are using a textbox etc. That or you can insert the text into an element using innerHTML but with no actual HTML in it and style it through CSS. You could also convert any HTML tags you want to show as their entities instead so that way they will display rather than render.

Those are your primary choices. :)
Was This Post Helpful? 0
  • +
  • -

#3 jim2854  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 7
  • Joined: 10-December 09

Re: Raw HTML

Posted 04 April 2010 - 10:22 AM

Thanks! I'll try innerTEXT
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1