未终止的字符串文字jquery [英] Unterminated string literal jquery

查看:95
本文介绍了未终止的字符串文字jquery的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用以下代码获取未终止的字符串文字错误。有人可以帮助我并指出错误。



Getting unterminated string literal error with below code. Can someone please help me and point out the mistake.

$(htmlContent).find('a.someClass').append(
    '<img src="https://pmcontent.blob.core.windows.net/images/oneDocument.png" 
    title="click to send" />')

推荐答案

(htmlContent).find(' < span class =code-string> a.someClass')。append(
' < img src =https://pmcontent.blob.core.windows.net/images/oneDocument.png
title =click to send/>'
(htmlContent).find('a.someClass').append( '<img src="https://pmcontent.blob.core.windows.net/images/oneDocument.png" title="click to send" />')


这只是因为字符串文字中的新行。如果您修复它会起作用,比如说:

This is just because of new line inside the string literal. It will work if you fix it, say, like this:


(htmlContent).find( a.someClass')。append(
' < img src =https://pmcontent.blob.core.windows.net/images/oneDocument.pngtitle =click to send/>');
(htmlContent).find('a.someClass').append( '<img src="https://pmcontent.blob.core.windows.net/images/oneDocument.png" title="click to send" />');





你能看出差异吗? :-)



-SA


这篇关于未终止的字符串文字jquery的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆