February 2014
Intermediate to advanced
410 pages
8h 15m
English
jQuery allows the developer to dynamically change images on a web page. This recipe will show you how to do this and also show you how to use a timestamp in order to prevent the browser from using a cached image, which can often be a problem when swapping images dynamically in this way.
For this recipe, you are going to need four different images. Ensure that you have four small images named black.png, red.png, blue.png, and green.png available.
To understand how jQuery can be used to change an image, complete each of the following steps:
recipe-8.html within an easily accessible directory, and add the following HTML code to this file:<!DOCTYPE html> <html> <head> <title>Change ...
Read now
Unlock full access