我正在动态创建以下HTML字符串
我是这样尝试的,
将\结尾,但我在浏览器控制台
下面的错误未捕获的SyntaxError:意外的标记ILLEGAL
var html = '<div class="lastItm_Wrap" id="lastwrap1239" data-stuff="[]" data-vegornonveg="vegterian" data-lastwrapquan="0">\
<div class="prd_title">\
<h3 class="vegLabel" data-sellprice="12.00" data-sellpricestatic="12.00" data-discprice="0.00" data-discpricestatic="0.00" data-strikeprice="0" data-strikepricestatic="12.00" data-ispercent="0">Pepsi<button style="display:none;" class="btn-d icon-ellipsis prdDiscription ui-btn ui-shadow ui-corner-all"></button></h3>\
</div>\
<div class="Itm_left_aside">\
<div class="Itm_img">\ <img id="imagesd" type="img" height="40" width="40" src="images/icon_logo.png"> </div>\
<div class="Itm_dtsl">\
<div class="Qty_Wrap">\
<button class="btn-d icon-minus QtyBtn ui-btn ui-shadow ui-corner-all"></button>
<div class="ui-input-text ui-body-inherit ui-corner-all ui-shadow-inset"><input type="text" class="QtyInput" value="2" readonly=""></div>
<button class="btn-d icon-plus QtyBtn ui-btn ui-shadow ui-corner-all"></button>
</div>
<button style="display:block;" class="btn-d addonsBtn ui-btn ui-shadow ui-corner-all" data-toppname="Topping" data-crutsname="Crust" data-atrr="1239"><a data-rel="popup" data-position-to="window" class="ui-link">Addons</a></button>
</div>\
</div>\
<div class="Itm_right_aside" data-percentage="0">\
<a class="icon-trash-3 deletebtn trashBtn ui-link" style="display: none;"></a>\
<p style="display:none;">₹ <strike class="strikeprice">24.00</strike> <span style="display:inline-block;" class="tobeappend offRed">₹</span> <span class="discprice offRed">0.00</span> <span class="offRed" style="display:inline-block;">off</span> <span class="offRed" style="display:none;">off</span> </p>\
<p>₹ <b class="sellprice">24.00</b></p>\
<p class="additionsclassstyle" style="display: none;"><span>Additions:₹</span> <b class="additions">0.00</b></p>\
</div>\
<div class="Itm_discrp" style="display:none;">\
<h3>Pepsi</h3>\
</div>\
</div>\
<div style="display: none;" id="addonsWrap1239-placeholder">\
</div>'
This is my fiddle ,
http://jsfiddle.net/9vr6bmpz/1/
能告诉我如何解决这个问题。
答案 0 :(得分:1)
http://jsfiddle.net/9vr6bmpz/4/
var html = '<div class="lastItm_Wrap" id="lastwrap1239" data-stuff="[]" data-vegornonveg="vegterian" data-lastwrapquan="0">\
<div class="prd_title">\
<h3 class="vegLabel" data-sellprice="12.00" data-sellpricestatic="12.00" data-discprice="0.00" data-discpricestatic="0.00" data-strikeprice="0" data-strikepricestatic="12.00" data-ispercent="0">Pepsi<button style="display:none;" class="btn-d icon-ellipsis prdDiscription ui-btn ui-shadow ui-corner-all"></button></h3>\
</div>\
<div class="Itm_left_aside">\
<div class="Itm_img"><img id="imagesd" type="img" height="40" width="40" src="images/icon_logo.png"></div>\
<div class="Itm_dtsl">\
<div class="Qty_Wrap">\
<button class="btn-d icon-minus QtyBtn ui-btn ui-shadow ui-corner-all"></button>\
<div class="ui-input-text ui-body-inherit ui-corner-all ui-shadow-inset"><input type="text" class="QtyInput" value="2" readonly=""></div>\
<button class="btn-d icon-plus QtyBtn ui-btn ui-shadow ui-corner-all"></button>\
</div>\
<button style="display:block;" class="btn-d addonsBtn ui-btn ui-shadow ui-corner-all" data-toppname="Topping" data-crutsname="Crust" data-atrr="1239"><a data-rel="popup" data-position-to="window" class="ui-link">Addons</a></button>\
</div>\
</div>\
<div class="Itm_right_aside" data-percentage="0">\
<a class="icon-trash-3 deletebtn trashBtn ui-link" style="display: none;"></a>\
<p style="display:none;">₹ <strike class="strikeprice">24.00</strike> <span style="display:inline-block;" class="tobeappend offRed">₹</span> <span class="discprice offRed">0.00</span> <span class="offRed" style="display:inline-block;">off</span> <span class="offRed" style="display:none;">off</span> </p>\
<p>₹ <b class="sellprice">24.00</b></p>\
<p class="additionsclassstyle" style="display: none;"><span>Additions:₹</span> <b class="additions">0.00</b></p>\
</div>\
<div class="Itm_discrp" style="display:none;">\
<h3>Pepsi</h3>\
</div>\
</div>\
<div style="display: none;" id="addonsWrap1239-placeholder">\
</div>'