Escape HTMLString

Download escapeHTMLString.js
Author: sam AT sam-i-am.com
last modified: October 06, 2000

Another simple tool that converts a few key characters to their escaped entity equivalents - for displaying HTML code on a page.

Specifically it examines the selection (or the whole document if there's no selection) and makes the following substitutions

 

Character

  becomes.... 

Escape Entity

< &lt;
> &gt;
& &amp;
" &quot;

There are no prompts - just select and hit the button. You can always undo if you screw up. It now also maintains your selection - resizing it to fit the new escaped code.. so you don't have to.