I have a document.write statement that I’m using to write some HTML. My question is, do I need to escape anything more than the / and “” ?
document.write('<div style=\"display:none;\"><\/div>');
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You don’t even need to escape the double quotes in this string – that’s only necessary if you enclose your string with double quotes.
You shouldn’t need to escape your
/es either; they don’t break the string anddocument.write()(afaik) allows plain HTML to be inserted.