Home > Web Front-end > JS Tutorial > How to modify image src with jquery

How to modify image src with jquery

藏色散人
Release: 2020-11-17 10:48:26
Original
4456 people have browsed it

Jquery method to modify image src: first open the corresponding front-end code file; then pass "$("#img1").attr("src", "img/" index ".jpg" );" Just modify the image src.

How to modify image src with jquery

Recommended: "javascript basic tutorial"

jquery changes the src of img:

img.src="img/" +index+ ".jpg";  //js方式
 
$("#img1").attr("src", "img/" +index+ ".jpg" ); //jq方式
Copy after login

The above is the detailed content of How to modify image src with jquery. For more information, please follow other related articles on the PHP Chinese website!

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