How to change the background image using jQuery?Changing a background-image using jQuery is an easy task. We can use the css() method and the url() function notation to change the background-image. The syntax to change the background-image using jQuery is given as follows. We can directly pass the image to the url() function as given above, or it can be done by storing the image in a variable and pass the variable name to the url as given below. ExampleIn this example, there is a div element with its background-image. We are using the css() method and url() function notation to change the background-image of the corresponding div element. Test it NowOutput After the execution of the above code, the output will be - On clicking the given button, the output will be - Next TopicHow to Detect a Mobile Device in jQuery |
We provides tutorials and interview questions of all technology like java tutorial, android, java frameworks
G-13, 2nd Floor, Sec-3, Noida, UP, 201301, India