JavaRanch Home    
 
This page:         last edited 08 May 2009         What's Changed?         Edit

Escape Html   

Eric put together a handy way to escape html for posting in the forums.

javascript:var elem = document.forms[0].message;elem.value = elem.value.replace(/on/gi,"on").replace(/mouse/gi,"mouse").replace(/>/gi,">").replace(/</gi,"<");void(0);

You can either copy paste this into the address bar or create a bookmarklet (a bookmark with this JavaScript? as the source.)

Source: http://www.coderanch.com/t/121937/HTML-JavaScript/html-escaper


CategoryJForum

JavaRanchContact us — Copyright © 1998-2014 Paul Wheaton