简体   繁体   中英

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.

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>")

确保您给了正确的报价

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM