Setting div background image using JQuery

css, jquery

Solution

maybe it also works with `background` but i always use

background-image

And also I always put quotes around the path

$('#pic').css("background-image","url('images/pic.jpg')"); 

Problem

Im using JQuery to set the background image of a div as follows: ``` $(document).ready(function() { $('#pic').css("background","url(images/pic.jpg)"); }); ``` But the image does not get displayed. How to fix this ? Thank You.

Original source