我有一个选择器,有时会选择window
对象,有时不会。我如何从选择器中确定是否确实选择了window
对象?
var selector = null
if(certain condition is met){
selector = $('#myDiv');
} else {
selector = $(window);
}
if($.isWindow(selector)){ //<-- does not work because the object is a jQuery selector
//do something
}