jQuery Get and Set Image Src Example
jQuery Get and Set Image Src Example
Overview
How to get the src image and set the src image using jQuery attr (). In this article, you will learn how to get and set the src image using jQuery.
The attr () method to get and change the image source in jQuery.
Get Image Src
Use the below script to get the src image.
$(document).ready(function() { $('.btn').click(function(){ $imgsrc = $('img').attr('src'); alert($imgsrc); }); });
View On WordPress











