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
- HTML | Change Background color using onmouseover property
- How to change background color of canvas-type text using Fabric.js ?
- How to change background color of a canvas circle using Fabric.js ?
- How to change selection background color of a canvas circle using Fabric.js ?
- Difference between background and background-color
- How to change the background color of the active nav-item?
- How to change the “checked” background color of toggle switch in Bootstrap 4?
- Background Subtraction in an Image using Concept of Running Average
- How to give text or an image transparent background using CSS?
- Set the size of background image using CSS ?
- How to stretch and scale background image using CSS?
- How to Rotate Container Background Image using CSS ?
- How to Create a Wave Image for a Background using HTML and CSS ?
- How to Add Image in Text Background using HTML and CSS ?
- How to add filter to the background 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