Escaping HTML strings with jQuery

Posted by Page Brooks on Stack Overflow See other posts from Stack Overflow or by Page Brooks
Published on 2008-08-24T02:52:42Z Indexed on 2010/06/02 0:03 UTC
Read the original article Hit count: 140

Filed under:
|

Does anyone know of an easy way to escape HTML from strings in jQuery? I need to be able to pass an arbitrary string and have it properly escaped for display in an HTML page (preventing JavaScript/HTML injection attacks). I'm sure it's possible to extend jQuery to do this, but I don't know enough about the framework at the moment to accomplish this.

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about jQuery