has no method ' 数据'"-6ren"> has no method ' 数据'"-$.each($('input[value|="Disable Login"]'), function() { alert(this.data('id')); }); 给出 "Uncaught-6ren">
gpt4 book ai didi

javascript - jQuery: .each .data ('key' ) 给出 "Uncaught TypeError: Object # has no method ' 数据'"

转载 作者:行者123 更新时间:2023-12-02 19:20:38 27 4
gpt4 key购买 nike

$.each($('input[value|="Disable Login"]'), function() {
alert(this.data('id'));
});

给出

"Uncaught TypeError: Object # has no method 'data'".

最佳答案

您可能正在寻找:

$('input[value|="Disable Login"]').each(function(){
alert($(this).attr("id"));
});

此外,您可以考虑将其应用到文档的子部分。像这样:

$('input[value|="Disable Login"]',$("#myform")).each(function(){
alert($(this).attr("id"));
});

关于javascript - jQuery: .each .data ('key' ) 给出 "Uncaught TypeError: Object #<HTMLInputElement> has no method ' 数据'",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12568174/

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