So while trying to work on this piece of code for school I keep running into this error. \"Uncaught TypeError: Cannot set property \'src\' of null\" Essentially what I\'m tryin
Assuming that bigPic
is in fact the ID of an img
tag, you are going to want to do document.getElementById('bigPic')
instead of using #bigPic
.
You are mixing the CSS selector that you'd use in jQuery or CSS (i.e., $('#bigPic')
) with plain javascript. Using the getElementById
function, you're already saying you're looking for something by the ID.