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
|
JavaTpoint offers too many high quality services. Mail us on h[email protected], to get more information about given services.
JavaTpoint offers college campus training on Core Java, Advance Java, .Net, Android, Hadoop, PHP, Web Technology and Python. Please mail your requirement at [email protected].
Duration: 1 week to 2 week