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

How to modify image src with jquery

藏色散人
藏色散人Original
2020-11-17 10:48:264386browse

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方式

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!

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