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 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 ?
- CSS | background-image Property
- Set the size of background image using CSS ?
- How to Add Image in Text Background using HTML and CSS ?
- How to Rotate Container Background Image using CSS ?
- How to stretch and scale background image using CSS?
- How to change color of PNG image using CSS?
- How to give text or an image transparent background using CSS?
- How to Create a Wave Image for a Background using HTML and 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 firstname.lastname@example.org. 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