1

Am I using the CDATA correctly in code below because I am getting no error but getting warnings on start tag < starting here...

var $tbody = $('#qandatbl_onthefly > tbody'); var $tr = $("<![CDATA[<tr class='optionAndAnswer' align='center'>]]"); var $qid = $("<![CDATA[<td width='5%' class='qid'></td>]]").text(qnum); var $options = $("<![CDATA[<td><table class='option'><tbody><tr><td class='opt'>1. Option Type:</td></tr></tbody></table></td>]]"); var $video = $("<![CDATA[<td width='17%' class='video'></td>]]"); var $endtr = $("<![CDATA[</tr>]]"); var $questionType = ''; 
4
  • Is there any reason you want to use CDATA? From the given code it is not necessary to use it. Commented Feb 2, 2013 at 17:03
  • May you post the warning you get? Commented Feb 2, 2013 at 17:04
  • 3
    What are you actually trying to do? Commented Feb 2, 2013 at 17:04
  • If any, the CDATA declaration should only be around the whole content of the script tag(s). Commented Feb 2, 2013 at 17:15

2 Answers 2

1

You probably don't need the CDATA sections, but the ones you have are incomplete. The end is missing an additional >:

<![CDATA[ ... ]]> <![CDATA[ <div>...</div> ]]> 

The trailing angle bracket is missing in the examples you provided.

Sign up to request clarification or add additional context in comments.

Comments

0

I think you dont need to use CDATA here. It's used when you get data from XML to recognize that it is the HTML content

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.