Return to Snippet

Revision: 40609
at February 4, 2011 07:41 by crutzdesigns


Initial Code
jQuery.extend({
  htmlentities : function(text){
    return $('<div/>').text(text).html();
  }
});

Initial URL


Initial Description
Takes a string as an argument and returns it with htmlentities

Usage:
$.htmlentities("<body>hello bob&doug</body>");

Returns:
&lt;body&gt;hello bob&amp;doug&lt;/body&gt;

Initial Title
jQuery.htmlentities

Initial Tags


Initial Language
jQuery