Reputation: 79
I would like to get the title witch is included in a other page (on same domain).
On the moment, the following code isn't working:
$.get("/example.html", function(html){
alert($(html).attr('title'));
});
Content of the example.html
page is:
<html>
<head>
<title>foo</title>
</head>
...
</html>
Upvotes: 1
Views: 28
Reputation: 67207
You can use filter()
at this context to filter out the title
tag,
alert($(html).filter("title").text());
And use .text()
to extract its text content.
Upvotes: 1