Abstract levels container

Łukasz Majta
  • Home
Switcher
Home > Development > HTML encoding in JavaScript

HTML encoding in JavaScript

January 15th, 2009
Goto comments Leave a comment

This little function converts HTML characters (for example brackets < >) to entities (like &lt; &gt;).

function escapeHTMLEncode(str)
{
	var div = document.createElement('div');
	var text = document.createTextNode(str);
	div.appendChild(text);
	return div.innerHTML;
}

Source: http://sanzon.wordpress.com

Łukasz Majta Development HowTo, JavaScript

Comments (0) Trackbacks (0) Leave a comment Trackback
  1. No comments yet.
  1. No trackbacks yet.
Subscribe to comments feed
How to back up/convert your VSS data to SVN Hitting the backbutton in the browser causes the fckeditor to display the HTML tags
RSS feed
  • Google
  • Youdao
  • Xian Guo
  • Zhua Xia
  • My Yahoo!
  • newsgator
  • Bloglines
  • iNezha
author

Recent Posts

  • Failed to start the database service MSSQL$Microsoft##SSEE
  • Creating SharePoint (Services) 2007 Workflows using VS2008 x64
  • SharePoint Services – Alerts aren’t working
  • Installing FitNesse as service
  • Usability: toolbox
  • Dynamiczne podpinanie zdarzeń w jQuery
  • How to back up/convert your VSS data to SVN
  • HTML encoding in JavaScript
  • Hitting the backbutton in the browser causes the fckeditor to display the HTML tags
  • How to call WebService via JavaScript

Categories

  • Development
  • Tools

Archives

  • November 2009
  • October 2009
  • March 2009
  • February 2009
  • January 2009

Meta

  • Log in
Top WordPress
Copyright © 2009-2010 Abstract levels container
Theme by mg12. Valid XHTML 1.1 and CSS 3.