开发者

Dynamic HTML 3 layers nested quotes - how to do?

I'm writing an app with JQuery开发者_运维知识库 & JQTouch fo iOS. I have a dynamically generated HTML list. The user clicks a row, which I need to highlight. However, this involves nesting 3 sets of quotes, which I can't figure out how to do! (I have it working using JQuery, but I'm hoping it'll be more efficient inline as it's only a small CSS change). My code is:

CURRENT_answerHTML += '<li id="1" onClick="this.className=nmclicked">' + localResultsArray[currentQuestionNumber].answer1_text + '</li>\n';

nmclicked needs to be in quotes as far as I'm aware, but no combination of escaping seems to work. The CSS is straighforward:

li.nmclicked { background: #5C94E7; }

Any ideas? Thanks.


CURRENT_answerHTML += '<li id="1" onClick="this.className=\'nmclicked\'">' + localResultsArray[currentQuestionNumber].answer1_text + '</li>\n';
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜