【发布时间】:2013-01-31 19:22:30
【问题描述】:
我想知道如何从 $(document) & $(window) 中获取选择器?
el = $(document);
alert(el.selector); // return nothing, I want to output -> document
el = $(window);
alert(el.selector); // return nothing, I want to output -> window
非常感谢!
【问题讨论】:
-
selector属性仅供内部使用,如果是这样,则只能用于调试。 -
你的意思是
alert(el.context);?选择器始终是字符串,您不会将任何选择器传递给 jQuery 函数。 -
如果您能详细说明为什么您需要这样做,您可能会得到一些有用的建议。
标签: javascript jquery window selector document