How to use double quote inside double quote?

24 views
Skip to first unread message

Magicloud Magiclouds

unread,
Aug 24, 2012, 12:23:09 AM8/24/12
to yeso...@googlegroups.com
I am quoting some json text in an attribute of a html element. And I
failed to get it compiled.
It is like: <option value="{"name":"magicloud","age":20}">text , since
jQuery only accepts double quoted token. So I changed the inside
quotes to \", and it did not work.
What should I do?
--
竹密岂妨流水过
山高哪阻野云飞

And for G+, please use magiclouds#gmail.com.

Michael Snoyman

unread,
Aug 24, 2012, 1:36:21 AM8/24/12
to yeso...@googlegroups.com
Try using single quotes inside the attribute. In general I would
recommend taking that approach for attributes. If you *really* need
double quotes, you have to use an entity (i.e., &quot;).

Magicloud Magiclouds

unread,
Aug 24, 2012, 4:45:01 AM8/24/12
to yeso...@googlegroups.com
I see. Pity that I cannot use single ones, jQuery.parseJSON only
accept double quotes.

Magicloud Magiclouds

unread,
Aug 24, 2012, 4:45:16 AM8/24/12
to yeso...@googlegroups.com
Forgot to say, thank you.

On Fri, Aug 24, 2012 at 4:45 PM, Magicloud Magiclouds
Reply all
Reply to author
Forward
0 new messages