【发布时间】:2014-01-08 11:38:23
【问题描述】:
我有很多图片的视图
<img src="@Path" data-img-prev="@UrlPreview" data-full-path="@UrlImage" onclick=Get() />
它会像这样在 html 中呈现
<img img-prev="1.jpg" data-full-path="https://...1.jpg" src="https://...1.jpg">
<img img-prev="2.jpg" data-full-path="https://...2.jpg" src="https://...1.jpg">
<img img-prev="3.jpg" data-full-path="https://...3.jpg" src="https://...1.jpg">
我希望函数从每个元素中获取数据
function Get() {
this.getAttribute('img-path');
this.data('img-path');
}
它不工作请帮助:
错误 this.getAttribute 不是函数
【问题讨论】:
-
怎么调用ttt()函数???是Get()函数吗?
-
你必须改进你的问题。呈现的 HTML 是什么?显然,这不是您发布的内容...
-
这么快就给我一点时间
-
容易投反对票很难取消投票...
标签: jquery this jquery-data