Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var image = document.getElementsByClassName('image');
- var mainImage = document.getElementById('main-image');
- image.forEach(function(img){
- img.onclick = function(){
- mainImage.src = img['data-whatever'];
- };
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement