1//change image src with jquery
2$("#myImageID").attr("src","images/my_other_image.png");
3
4//change image src plain javascript
5document.getElementById('myImageID').src="images/my_other_image.png";
6
1$(document).ready(function () {
2 $('img').click(function(){
3 $(this).attr('src','images/download.jpeg')
4 })
5})
1// https://codepen.io/kman/pen/dXjpoX
2// Stockphotos JS
3
4$(document).ready(function(){
5 var flag = 0;
6 $("button#changeSize").click(function(){
7 if(flag == 0) {
8 $("#dummyimage").attr("src","http://dummyimage.com/350x155/");
9 flag = 1;
10 }
11 else if(flag == 1) {
12 $("#dummyimage").attr("src","http://dummyimage.com/450x255/");
13 flag = 0;
14 }
15 });
16});