One line html decode entities (jQuery)

/ Published in: JavaScript
Save to your folder(s)

You need jQuery to make this work.

Copy this code and paste it in your HTML
  1. /* Sample Usage
  2. * var encodedHTML = '<a href="">text</a>';
  3. * var decodedHTML = html_decode(encodedHTML);
  4. */
  6. var html_decode = function(h){ return $('<p>'+h+'</p>').text(); }


Report this snippet


RSS Icon Subscribe to comments

You need to login to post a comment.