Reputation: 51
This is the result of my DOM
<div style="background: #fff url(" http:="" i.imgur.com="" qeoj4ae.png")="" no-repeat="" center="" center;"="">
what I did is like this :
var htmlBlock = '<div id="bannerWrap" style="background: #fff url("'+image+'") no-repeat center center;">';
why the slash got escaped? I console console.log(image), the slash is there.. I wonder..
Upvotes: 0
Views: 38
Reputation: 28513
Try this : use \'
to put images inside quotes.
var htmlBlock = '<div id="bannerWrap" style="background: #fff url(\''+image+'\') no-repeat center center;">';
Upvotes: 1