$('.imagepreview').attr('src', img) code example Example: jquery get image src $('.img1 img').attr('src');