Raapwerk
Raapwerk

Reputation: 629

Loading content from textarea when in view

I'm building a blog-like portfolio. I want the content of the posts to be loaded only when they are viewed. To do that I tried to store the HTML code in a textarea in the meantime and place it in a div when the post is viewed. This works fine but for some reason the content is not recognized as HTML when placed in the div.

Can anyone tell me why?

You can find the testpage here: http://www.raapwerk.nl/login/portfolio

Thanks!

Upvotes: 2

Views: 115

Answers (1)

floorish
floorish

Reputation: 718

A textarea contains text, no HTML, so when you copy the contents it will be plain text you're copying. Is there any specific reason you use a textarea?

Otherwise you can just change it to a div and it will work, see this update to your fiddle


EDIT

Easier method, which doesn't load the content before it is displayed: just get the value of the textarea instead of the innerHtml, see this fiddle

Upvotes: 1

Related Questions