Being new to javascript, I came to a situation where I need more information about escaping characters in a string.
Basically, I know that in order to exit "I need to replace it with \", but that I donβt know for what characters I need to escape a certain string. Is there a list of these "characters to escape"? or is it any character that is not a-zA-Z0-9?
In my situation, I have no control over the content that appears on my page. Users enter text and save it. Then I use webservice to retrieve them from the database, create an array of json objects, and then iterate the array when I need to display them. In this case, of course, I have no idea what the text entered by the user, and therefore for which characters I need to escape. I also use jQuery for this particular project (just in case, if it has a function that I don't know about, in order to do what I need)
The assignment of examples would be appreciated, but I also want to study theory and logic.
Hope someone can help.
source
share