jquery image src onclick

 

 

 

 

The main problem here is your anchor element, which cause the page to reload. Simply remove the anchor element and give the image a pointer cursor. You need to include jQuery in order to use jQuery syntax. cool i will try that, see what i come up with! Ill let you know, Thanks!!! hmm for some reason it isnt working, is it better to make the images links as well? put them in anchor tags? also should i have both images in the same div --- Angular Backbone Bootstrap 3 Bootstrap 4 D3 Ember Foundation GreenSock TweenMax Handlebars jQuery jQuery UI Lodash Modernizr Polyfill.io Polymer React React DOM Snap.svg Three.js Underscore Vue Zepto ZingChart. I am using the code to change the image src with jqueryPass some random number to the image:- (MyImageID).attr(src, image1.jpg?Math.random()) Try detaching and re-attaching the once you change the src. I am using the code to change the image src with jqueryMy problem is that although its actually changed the src its not actually showing the new image. Does it have to refresh the image ? How can I sort this? JS (jquery): (small-image).click(function() var imgsrc(this).attr( src) (large-image).attr(src,imgsrc) ) Its working well only on first image. I need it to work when any of the small images is clicked, not just the first. Unfortunately the regular jquery image "onclick" scripts I found for doing that dont seem to work, presumably because the "link" is being clicked, not the image?Changing src value using jQuery not working. When I click on the button related to each image, I want the image opacity to change to 0.5. Id rather do this without each image having an individual id. Warning: my jQuery knowledge is pretty average, I cant quite get my head around some of it!