Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/77.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 如何获取对jQuery选择器的引用';什么是退货清单?_Javascript_Jquery_Jquery Selectors - Fatal编程技术网

Javascript 如何获取对jQuery选择器的引用';什么是退货清单?

Javascript 如何获取对jQuery选择器的引用';什么是退货清单?,javascript,jquery,jquery-selectors,Javascript,Jquery,Jquery Selectors,我有一些jQuery函数: rfx.jQuery(function(){ rfx.jQuery(".form-row.errors").blur(some_function(this)) }); 但“this”是HTMLDocument,而不是选择器返回值的列表。如何获取对元素列表的引用?选择本身的结果,即rfx.jQuery(“.form row.errors”)将是返回元素的数组 但是在你的模糊事件中 rfx.jQuery(".form-row.errors").blur(func

我有一些jQuery函数:

rfx.jQuery(function(){
    rfx.jQuery(".form-row.errors").blur(some_function(this))
});

但“this”是HTMLDocument,而不是选择器返回值的列表。如何获取对元素列表的引用?

选择本身的结果,即
rfx.jQuery(“.form row.errors”)
将是返回元素的数组

但是在你的模糊事件中

rfx.jQuery(".form-row.errors").blur(function(){
     //`this` is the element reference... 
});
请参见此选项卡和输入框之间的选项卡

如果没有以下任一选项,则无法从模糊中访问完整选择:

a)
blur()函数中再次选择

rfx.jQuery(function(){
    rfx.jQuery(".form-row.errors").blur(function(){
         // `this` is the element which is blurring
         var formRowErrors = rfx.jQuery(".form-row.errors") //select again within the blur function
    });  
});
b)使用闭包,例如

rfx.jQuery(function(){
    var formRowErrors = rfx.jQuery(".form-row.errors");
    rfx.jQuery(".form-row.errors").blur(function(){
         // `this` is the element which is blurring
         // formRowErrors is the jQuery selection of all form-row.errors
    });  
});

但是,在第二种方法中,
var formRowErrors
将只包含绑定时的选择,即它不是“活动的”

选择本身的结果,即
rfx.jQuery(.form row.errors”)
将是返回元素的数组

但是在你的模糊事件中

rfx.jQuery(".form-row.errors").blur(function(){
     //`this` is the element reference... 
});
请参见此选项卡和输入框之间的选项卡

如果没有以下任一选项,则无法从模糊中访问完整选择:

a)
blur()函数中再次选择

rfx.jQuery(function(){
    rfx.jQuery(".form-row.errors").blur(function(){
         // `this` is the element which is blurring
         var formRowErrors = rfx.jQuery(".form-row.errors") //select again within the blur function
    });  
});
b)使用闭包,例如

rfx.jQuery(function(){
    var formRowErrors = rfx.jQuery(".form-row.errors");
    rfx.jQuery(".form-row.errors").blur(function(){
         // `this` is the element which is blurring
         // formRowErrors is the jQuery selection of all form-row.errors
    });  
});

但是,在第二种方法中,
var formrowrerrors
将只包含绑定时的选择,即它不是“活动的”

您有上下文问题

rfx.jQuery(".form-row.errors").blur(function(){
   some_function(this);
});
anonymus函数的结果将是
rfx.jQuery(“.form row.errors”)
this
相同,如果您这样做

rfx.jQuery(function(){
    rfx.jQuery(".form-row.errors").blur(some_function(this))
});

这将是
rfx.jQuery
中的上下文,您遇到了上下文问题

rfx.jQuery(".form-row.errors").blur(function(){
   some_function(this);
});
anonymus函数的结果将是
rfx.jQuery(“.form row.errors”)
this
相同,如果您这样做

rfx.jQuery(function(){
    rfx.jQuery(".form-row.errors").blur(some_function(this))
});

这将是
rfx.jQuery

中的上下文,我认为您无法访问
blur
函数中选择器的所有元素。您必须再次调用
jQuery(“.form row.errors”)
(或者以前将其存储在一个var中,前提是您不使用代码更改DOM)。您想将
某个函数
绑定到blur事件,还是它返回另一个您想绑定的函数?目前您正在执行后一种操作。要将某些函数绑定到模糊事件,我认为您无法访问
blur
函数中选择器的所有元素。您必须再次调用
jQuery(“.form row.errors”)
(或者以前将其存储在一个var中,前提是您不使用代码更改DOM)。您想将
某个函数
绑定到blur事件,还是它返回另一个您想绑定的函数?当前正在执行后一种操作。是否要将某些函数绑定到模糊事件