Posted By


crutzdesigns on 02/04/11

Tagged


Statistics


Viewed 144 times
Favorited by 0 user(s)

jQuery.htmlentities


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

Takes a string as an argument and returns it with htmlentities

Usage:
$.htmlentities("hello bob&doug");

Returns:
<body>hello bob&doug</body>


Copy this code and paste it in your HTML
  1. jQuery.extend({
  2. htmlentities : function(text){
  3. return $('<div/>').text(text).html();
  4. }
  5. });

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.