/ Published in: JavaScript
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
String.prototype.htmlEscape = function() {return this.replace(/&/g,'&').replace(/</g,'<').replace(/\>/g,'>')} // test it out... alert( '<a href="/?foo=1&bar=2"> blah </a>'.htmlEscape() );