Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community!
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.Start your free trial
CASEY KELLEHERCourses Plus Student 658 Points
the copy and paste function of the picimg is not changing the pic everytime i refresh the worksheet, it stays the same??
When copy and pasting the picimg file into the html code it is supposed to generate a new picture every time you refresh but its staying the same??
Steven Parker224,873 Points
Your browser may be displaying a cached image instead of fetching a new one.
document.querySelector("img").src += "?nocache=" + Math.random();
Note that this particular script will only work for the first image on the page, you may need a more specific selector otherwise.