JQuery - 通过 alt 或标题选择图像
你好,我需要这个 JQuery 来运行下面的图像。但这是我需要通过 alt 选择图像的技巧,我似乎无法让 JQuery 选择它
<script>
$('img[alt="800px-Red_Bull"]').onload = function() {
Pixastic.process(img, "desaturate", {average : false});
</script>
<img width="800" height="387" src=".../01/800px-Red_Bull.png" alt="800px-Red_Bull" title="800px-Red_Bull">
Hello I need this JQuery to run for the image bellow it. But here's the trick I need to select the image by it's alt, I can't seem to get the JQuery to select it
<script>
$('img[alt="800px-Red_Bull"]').onload = function() {
Pixastic.process(img, "desaturate", {average : false});
</script>
<img width="800" height="387" src=".../01/800px-Red_Bull.png" alt="800px-Red_Bull" title="800px-Red_Bull">
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您的问题不在于您的选择器,而是您没有正确使用
load
事件。将您的代码更改为:
Your problem is not with your selector, it's that you're not using the
load
event correctly.Change your code to this:
尝试:
Try: