Mike
Mike

Reputation: 3418

unterminated string literal jquery or more than that

Well I know jquery handles single quotes and double quotes differently for strings. What actually I am trying to do is open a popup on click of a link.

Below is what I am appending to the body on click of "a" tag:

$(".prop a").click(function() {
                $("body").append("<div class='lang'>
    <span class='propHead'>Security</span><a href='javascript:void(0);' class='cross' >X</a><div class='propText'>This will be having he description of each of the Language on whch you click with a link to pdf  documentatiom</div><span class='propBtmText'><a href='javascript:void(0)';>Download Documentation</a></span>
</div>")

But I get unterminated string literal. I see that I have properly appended the div and spans to body, but it just doesn't work.

Any help would be really appreciated.

Upvotes: 1

Views: 2427

Answers (3)

Ravi Kumar
Ravi Kumar

Reputation: 1923

make sure that you have given proper quote

Upvotes: 0

Joseph Marikle
Joseph Marikle

Reputation: 78520

Demo

The code seems to be fine. If that's verbose what you are using, javascript doesn't like multi-line strings, so you would need to use this instead:

$("body").append("<div class='lang'><span class='propHead'>Security</span><a href='javascript:void(0);' class='cross' >X</a><div class='propText'>This will be having he description of each of the Language on whch you click with a link to pdf  documentatiom</div><span class='propBtmText'><a href='javascript:void(0)';>Download Documentation</a></span></div>")

Upvotes: 5

Mike
Mike

Reputation: 783

Make sure you close your click. At the end add });

Upvotes: 0

Related Questions