PDA

View Full Version : change the chars "<" and ">" in string to i could see them in the html pag


frontline
12-01-2002, 08:59 AM
Hello
i have simple string validation script , and i like to add some kind of (RegExp preferred) check
that will replace me the "<" and ">" chars to its escape code so i could view strings like "<foo>" in the html page .
thanks

Jeepers
12-01-2002, 12:34 PM
If I follow what you mean use &lt; to display < and &gt; to display > in your html source

jkd
12-01-2002, 05:34 PM
str = str.replace(/</g, '&amp;lt;')

:)