为什么在这种情况下无法将$(frame)转换为jQuery对象? 以下是来自Chrome开发者工具的输出。
console: mainFrame
output: <frame src="http://someurl.com" name="mainFrame">
console: $(mainFrame).contents()
output: SyntaxError: Failed to execute 'querySelector' on 'Document': '[object HTMLFrameElement]' is not a valid selector.
编辑:
回应评论...
$.toString()
"function $(selector, [startNode]) { [Command Line API] }"
typeof(mainFrame)
"object"
jQuery
ReferenceError: jQuery is not defined
$.toString()
和typeof mainFrame
的输出是什么? - plalx$
不是jQuery,尝试使用jQuery(mainFrame).contents()
。 - Musa$
仍然可以作为选择器,但它实际上不是jQuery
? - Maximus S