jQuery get attribute

后端 未结 2 1914
不思量自难忘°
不思量自难忘° 2021-01-20 08:47

I\'m trying to get the source attribute of all images withing a specific div but somehow it keeps telling me that the function .attr() doesn\'t exist...

That\'s the

2条回答
  •  南笙
    南笙 (楼主)
    2021-01-20 09:14

    this is indeed an image element, and you need for it to be a jQuery element:

    var image = $(this);
    

提交回复
热议问题