To get the value of the src attribute of an image using jQuery, you can use the attr() method.

Here is an example:

// Get the src attribute value of an image with id "myImage"
var srcValue = $('#myImage').attr('src');

// Log the value to the console
console.log(srcValue);

In this example, $('#myImage') selects the image element with the id "myImage", and attr('src') retrieves the value of the src attribute. The value is then stored in the srcValue variable and logged to the console

img attr src by jquery

原文地址: https://www.cveoy.top/t/topic/hM5J 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录