Home > Article > Web Front-end > How to modify image src with jquery
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.
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!