Home  >  Article  >  Web Front-end  >  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
WBOYOriginal
2016-05-16 17:27:301116browse

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
Statement:
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