Working on an app that utilizes JQuery and JQTouch for iOS. The issue I'm facing involves dynamically generated HTML lists where the user clicks a row that needs to be highlighted. However, achieving this has proven tricky due to nesting 3 sets of quotes in the code. Currently, I have it functioning using JQuery, but I am looking for a more efficient inline solution since it's just a simple CSS modification. Here's a snippet of my code:
CURRENT_answerHTML += '<li id="1" onClick="this.className=nmclicked">' + localResultsArray[currentQuestionNumber].answer1_text + '</li>\n';
The class nmclicked
must be enclosed in quotes from what I understand, but all attempts at proper escaping haven't been successful. The CSS styling is straightforward:
li.nmclicked { background: #5C94E7; }
Any suggestions or solutions would be greatly appreciated. Thank you.