How to set background image in CSS using jQuery?


To set the background image using jQuery, use the jQuery css() method.


Use the background-image property to add background image to the web page.

Live Demo

<!DOCTYPE html>
<script src=""></script>
$(".bg").css("background-image", "url('/css/images/css.jpg')");
<body class="bg">

Learn more here



At we help IT students and Professionals by providing important info. about latest IT Trends & for selecting various Academic Training courses.