javascript - JQuery 在其他函数中使用每个函数
问题描述
我正在使用 AJAX 函数,结果我正在$('.class').each
执行一些逻辑。
问题是调用$(this)
以检索每个对象,是指 AJAX 函数而不是找到的元素。
如何引用each
函数中的元素?
$.ajax({url: "myurl", success: function(result){
$(".my_class").each((index, dom) => {
console.log(($(this))); //this is the ajax funct, not the object i want
});
});
解决方案
推荐阅读
- android-studio - 键盘和快捷键在 Windows 的 Android Studio 中不起作用
- parsing - ANTLR 列表以空格分隔
- php - 语法错误,php shell 代码中的意外 (T_VARIABLE)
- c++ - 如何使用 C++ SDK 修复同步调用的 aws lambda 超时?
- c# - 装饰多个实现的接口之一
- mysql - 如何使用 JOIN 和多个排序条件创建 MySQL 5.6 Rank
- javascript - 用于将 .csv 转换为 .html 并处理多个文件的 Powershell 脚本
- dynamics-business-central - 如何在 AL 中发送获取请求
- python - 在 Python 中导入 EmguCV 失败
- pandas - 关于从 TK 表单插入到 csv 文件的问题