我可以从jquery事件函数中获取值吗?
我想要得到这样的东西:
function Init() {
var my_variable = $some_object.click(function() {
var my_variable = 'value';
return my_variable // I need to get the variable value from click event
// but I don't know ways to do it
});
console.log(my_variable); // I want to have possibility to use the value here
}
最佳答案
没有。
设置事件处理程序的函数将在事件处理程序运行之前完成运行。
关于javascript - 如何从jquery事件函数返回变量值?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27859806/