By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
437,636 Members | 1,213 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 437,636 IT Pros & Developers. It's quick & easy.

How to put a single quote in a JS var defined by single quotes

P: n/a
var a = 'what goes in here to get a single quote?';

Jul 6 '08 #1
Share this Question
Share on Google+
2 Replies


P: n/a
gi*******************@yahoo.com wrote:
var a = 'what goes in here to get a single quote?';
Escape the quote as \'.

--

Martin Honnen
http://JavaScript.FAQTs.com/
Jul 6 '08 #2

P: n/a
On Jul 7, 12:07 am, Martin Honnen <mahotr...@yahoo.dewrote:
gimme_this_gimme_t...@yahoo.com wrote:
var a = 'what goes in here to get a single quote?';

Escape the quote as \'.
var a = "alternatively use outer 'double quotes' to allow single
quotes in the string";
var b = 'remember, "single quotes" and "double qoutes" means exactly
the same thing';
Jul 7 '08 #3

This discussion thread is closed

Replies have been disabled for this discussion.