it seems that we need to write our own version of PHP's htmlspecialchars() if we want to do it in javascript huh? let's say if we want to do things like document.getElementById("divCode") = "if (a < 10) { ... }"; or document.getElementById("divCode") = "use <span> if you want to ... Use © if you want to..."; then we will need to change the "<" into < (and so forth for the "&" etc) so it will be handy if there is a built-in function that will do that. Looks like prototype.js doesn't have that if i do a search on google using htmlspecialchars site: prototypejs.org Thanks very much!
document.getElementById("divCode").appendChild(document.createTextNode("if (a < 10) { ... }")); Code (markup):
JavaScript do not have fuunction similiar to that function, so we must create it, you can see this example code Whenever you need 1 operation in JavaScript, you can visit http://javascriptbank.com