Verbose Logging

software development with some really amazing hair

06 Nov 09

04:49 PM MDT

Posted in Software

Unescape HTML with Javascript

I’m just passing this on, as I didn’t do it, I just found it.

Over here is a pretty slick way to unescape HTML. I ran into the need for this when I was working on some inline-editing code. I wanted to reset the contents of the textarea to the contents of a pre tag. The contents of the tag are of course escaped, but I want them to be proper HTML in the textarea. Using this trick allowed me unescape the contents easily and stuff it back in the textarea.

My function:

Can't see this Gist? View it on Github!

Good Stuff.™

Share/Bookmark

blog comments powered by Disqus