Home > Web Front-end > JS Tutorial > Jquery dynamically changes the use of src and Attr of a bitmap_jquery

Jquery dynamically changes the use of src and Attr of a bitmap_jquery

WBOY
Release: 2016-05-16 17:27:30
Original
1161 people have browsed it

Today I want to use Jquery to dynamically change the src of a bitmap and found that css is not easy to use. Looking at the Jquery document, it seems that css is used to set style attributes, such as color, font, background, etc., while attr seems to be able to operate all attributes, including Jquery Unencapsulated properties.

Copy code The code is as follows:

$("#newClassImg").attr("src ", "./images/plus3.jpg");//Change the image source
$("#newClass").css("background-color", "#d6d6d6");//Change the background color

Recommend a Jquery Chinese document query website

http://jquery-api-zh-cn.googlecode.com/svn/trunk/index.html
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template