Javascript jquery从加载的远程页面中选择h1,单位为$(数据)

Javascript jquery从加载的远程页面中选择h1,单位为$(数据),javascript,jquery,html,Javascript,Jquery,Html,我正在尝试从已加载到$data的远程页面中选择h1。 无论我怎么尝试,我似乎都无法正确地理解代码。 如果我使用此代码: console.log($(data)); 我得到: [text, meta, text, meta, text, script, text, title, style, text, style, text, h1, text, h2, text, br, text, br, text, table, text, hr, init: function, selector: "

我正在尝试从已加载到$data的远程页面中选择h1。 无论我怎么尝试,我似乎都无法正确地理解代码。 如果我使用此代码:

console.log($(data));
我得到:

[text, meta, text, meta, text, script, text, title, style, text, style, text, h1, text, h2, text, br, text, br, text, table, text, hr, init: function, selector: "", jquery: "1.4.2", size: function, toArray: function…]
在索引12处是我想要获取的。但是怎么做呢? 我原以为这样行得通,但结果一无所获:

console.log($(data).find('h1').text());
如果我删除文本,我会得到:

[prevObject: c.fn.c.init[23], context: undefined, selector: "h1", init: function, jquery: "1.4.2"…]
context: undefined
length: 0
prevObject: c.fn.c.init[23]
0: text
1: meta
2: text
3: meta
4: text
5: script
6: text
7: title
8: style
9: text
10: style
11: text
12: h1
13: text
14: h2
15: text
16: br
17: text
18: br
19: text
20: table
21: text
22: hr
length: 23
__proto__: Object[0]
selector: "h1"
__proto__: Object[0]
这就是指数12。我错过/不明白的是什么

致意 Niclas

Find将采用以下示例

$('<p></p><a>One</a>').find('a').text(); 
Outputs: ""
$('<p><a>Two</a></p><a>One</a>').find('a').text();
Outputs: "Two"
注意


您能在JSFIDLE中显示您的代码和数据吗?Does.filter'h1.文本工作吗?filter'h1'工作,谢谢!现在这是有道理的:
$('<p></p><a>One</a>').filter('a').text(); 
Outputs: "One"