Javascript uses ‘ \ ‘ (backslash) in front as an escape character. This was achieved by two methods. Pass Single Quotes in javascript function - CodeProject How to escape single quote in sed? - NewbeDEV Support Specialist Posts: 590 Joined: Tue Jul 17, 2012 8:12 pm Location: Phoenix, AZ. Below are couple of methods. Tryit Editor Thanks for the reply Scott --. You just need to escape the same quote style as you’re using to define the string. This question already has an answer here Javascript Razor and Escape characters Like apostrophe ... Login Register ... How to escape double and single quote from JS string. You will need to use escape sequences to insert special characters correctly. I tend to mix double quotes and backtick literals in my code, although I have considered using backtick literals exclusively.. Escape Quotes in JavaScript