gpt4 book ai didi

javascript - ID 未定义,但事实并非如此?

转载 作者:行者123 更新时间:2023-11-28 13:55:27 24 4
gpt4 key购买 nike

请看这个 fiddle :http://jsfiddle.net/DHts6/1/

为什么它说未定义,即使id =“foo”已设置!

谢谢

最佳答案

您不需要$(this).id,只需执行this.id即可。

原因是 $ 创建了一个没有 .id 属性的 jQuery 对象。在 jQuery 中你可以使用 attr $(this).attr('id')

http://jsfiddle.net/DHts6/5/

关于javascript - ID 未定义,但事实并非如此?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8217847/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com