gpt4 book ai didi

javascript - jQuery 从 $el 获取 ID

转载 作者:行者123 更新时间:2023-11-28 17:49:45 24 4
gpt4 key购买 nike

嘿,我只是在寻找元素的 ID,而就是我为了获取它而必须使用的所有内容。

_open: function() {
toolTip(false);
theLimit = this.options.limit;
console.log('debug: ', $(this)[0]);

if (this.options.showDropdown !== false) {
if (tagLimit != this.options.limit) {
this.open();
} else {
toolTip(true);
}
}
},

上面的 JS 尝试从 $(this)[0] 获取 ID

我已经尝试过

$(this)[0].el.attr('id')

$(this)[0].el.attr('id')

$(this)[0].attr('id')

$(this).attr('id')

this.attr('id')

但是当它应该显示bomtags时,除了未定义之外,它们不会产生任何东西。

enter image description here enter image description here enter image description here

上图显示了$(this)[0]当前的输出。

如何获取该 id 值?

最佳答案

根据调试信息应该是:

this.$el[0].id

关于javascript - jQuery 从 $el 获取 ID,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45826473/

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