To change the background image using jQuery, you can use the jQuery CSS() method. For this, the whole property value is specified using the url() functional notation.
Approach: Suppose we have an image URL stored in a variable and then use css() method to change the value of background image.
Below example illustrates the above approach:
- JQuery | Setting background-image using CSS property
- How to change the background color of the active nav-item?
- How to change background color of a canvas circle using Fabric.js ?
- HTML | Change Background color using onmouseover property
- How to change selection background color of a canvas circle using Fabric.js ?
- How to change background color of canvas-type text using Fabric.js ?
- Set the size of background image using CSS ?
- CSS | background-image Property
- How to stretch and scale background image using CSS?
- How to Rotate Container Background Image using CSS ?
- How to Add Image in Text Background using HTML and CSS ?
- CSS | Combine background image with gradient overlay
- How to Create a Wave Image for a Background using HTML and CSS ?
- How to give text or an image transparent background using CSS?
- How to change color of PNG image using CSS?
- Background Subtraction in an Image using Concept of Running Average
- How to change an input button image using CSS?
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.
Improved By : nidhi_biet