Posted By

tomasdev on 12/31/10


Tagged

js html jquery entity decode


Versions (?)

Who likes this?

1 person have marked this snippet as a favorite

Internet-Uzver


One line html decode entities (jQuery)


 / Published in: JavaScript
 

URL: http://tomasdev.com.ar

You need jQuery to make this work.

  1. /* Sample Usage
  2. * var encodedHTML = '<a href="http://link.com">text</a>';
  3. * var decodedHTML = html_decode(encodedHTML);
  4. */
  5.  
  6. var html_decode = function(h){ return $('<p>'+h+'</p>').text(); }

Report this snippet  

You need to login to post a comment.