admin管理员组文章数量:1387287
I am using this / library and I don't know how to show the value of the src image when clicked.
Can you help me?
This is my example:
$("select.image-picker.show-labels").imagepicker({
hide_select: true,
show_label: true,
clicked:function(){
console.log($(this).find("img").attr("src"));
}
});
I am using this http://rvera.github.io/image-picker/ library and I don't know how to show the value of the src image when clicked.
Can you help me?
This is my example:
$("select.image-picker.show-labels").imagepicker({
hide_select: true,
show_label: true,
clicked:function(){
console.log($(this).find("img").attr("src"));
}
});
Share
Improve this question
edited Oct 20, 2022 at 21:30
Brian Tompsett - 汤莱恩
5,89372 gold badges61 silver badges133 bronze badges
asked Jun 18, 2013 at 8:57
jcarloswebjcarlosweb
9742 gold badges15 silver badges34 bronze badges
1
- the value is undefined, thanks – jcarlosweb Commented Jun 18, 2013 at 9:03
1 Answer
Reset to default 7This should do it :
$(this).find("option[value='" + $(this).val() + "']").data('img-src');
$(this)
is the select input, you're trying to find the option which is selected and to get the img-src data attribute.
Though, are you sure you shouldn't just get the Id of the image you selected through $(this).val()
?
本文标签: javascriptimagepicker jQuery callback clickedStack Overflow
版权声明:本文标题:javascript - imagepicker jQuery callback clicked - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744482909a2608276.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论