开发者

formatting for concatenated string jquery

开发者 https://www.devze.com 2022-12-28 10:50 出处:网络
Hi I\'m trying to get this $( \"<div class=\\\"images\\ style=\\\"background:url(\'\" + item.link + \"\')no-repeat top center;\\\"/>\").appendTo(\"#images\").wrap(\"<a target=\\\"_blank\\ hr

Hi I'm trying to get this

$( "<div class=\"images\ style=\"background:url('" + item.link + "')no-repeat top center;\"/>").appendTo("#images").wrap("<a target=\"_blank\ href='" + item.link + "'></a>");

to output correctly but I'm not very hot on concatenating javascript strings. It's the line 开发者_如何学运维background div I can't get right.

cheers

Andy


Try

$( "<div class='images' style='background:url(" + item.link + ")no-repeat top center;'/>").appendTo("#images").wrap("<a target='_blank' href=" + item.link + "></a>");
0

精彩评论

暂无评论...
验证码 换一张
取 消