I am trying to add a background image to a dynamically generated div. When I add the CSS property for the background, like below, it breaks my plugin:
$("<div>", {
'class': "iviewer_image_mask",
css: "background: url('http://somesite.com/path/to/image.jpg');"
}).appendTo(this.container);
Anybody know what I am doing wrong to add the background image?
According to some benchmarking reported in this SO question, I believe the most efficient way to create your HTML element using jQuery would be this:
Or for some extra readability: