how to set background image in jquery code example
Example 1: change background image with jquery
jQuery(document).ready(function($) {
$('.bg-image').css("background-image", "url('myurl.jpg')");
});
Example 2: add background image to div using jquery
var imageUrl = "images/sky.jpg";
$(".div_with_class").css("background-image", "url(" + imageUrl + ")");
Example 3: jquery set style background image
$('myObject').css('background-image', 'url(' + imageUrl + ')');