How on earth do you encode HTML with jQuery/JavaScript?
Havn't found any working solution after hours of Googling and surfing this site.
This:
jQuery('<div/>').text(value).html();
does not work with jQuery!
What do you mean with "encode"?
If you mean something similar to PHP's htmlentities, your solution should work with jQuery:
What you have works, you can test it here, make sure you're using that to get the encoded text.
If your goal is to encode it for transmission (e.g. a POST), you should be looking at encodeURIComponent() instead, for example:
var encodedString = encodeURIComponent(value);