Using Jquery to dynamically change the src of a bitmap, it is found that css is not easy to use, while attr seems to be able to operate on all attributes, including attributes not encapsulated by Jquery. The specific implementation is as follows, if you are interested, you can refer to the following: I want to use Jquery to dynamically change the src of a bitmap and find that css is not easy to use. It seems that css is used to set the style attributes, such as color and font, background, while attr seems to be able to operate all attributes, including attributes not encapsulated by Jquery.
The Code is as follows:
$ ("# NewClassImg"). attr ("src", "./images/plus3.jpg"); // change the image source
$ ("# NewClass" ).css ("background-color", "# d6d6d6"); // change the background color
A Jquery Chinese Document query website is recommended.
Http://jquery-api-zh-cn.googlecode.com/svn/trunk/index.html