CoderZone.org

Category: >> JavaScript >> Convert entities into normal characters Bookmark and Share

<< lastnext >>

Snippet Name: Convert entities into normal characters

Description: Converts entities (e.g., &, é) back into normal characters (e.g., &, ).

Also see:

Comment: (none)

Author: CoderZone
Language: JAVASCRIPT
Highlight Mode: JAVASCRIPT
Last Modified: December 01st, 2010

function html_entity_decode(str) {
  var ta=document.createElement("textarea");
  ta.innerHTML=str.replace(/</g,"&lt;").replace(/>/g,"&gt;");
  return ta.value;
}
 
 
There haven't been any comments added for this snippet yet. You may add one if you like.  Add a comment 
© coderzone.org | users online: 5