Jquery selector for <link> elements in <head>

Viewed 6432

We use jQuery to parse some HTML. I then need to traverse that document and find some elements. Among the elements I need to find, there are the <link> elements.

This works perfectly well to extract all the <a> elements:

$(string).find("a")

but this doesn't work to extract the <link> elements :

$(string).find("link")

The string parameter is the html content (e.g. received on a request).

Any idea why? (I guess that the find only applies to the <body> elements). Also, any idea on how to actually extract these <link> elements?

4 Answers
Related