Reputation: 33
I'm writing a greasemonkey script with some JQuery in it.
I load a number of pages into variables. I use the $.get to get the pages in the variables/array. That works fine.
Now I'am wondering how I can extract data from pages that are stores in the variables by using jquery selectors.
What I want to do is write stuff like this:
mypages[i].(".foo a").each(function( index ) {...});
Upvotes: 1
Views: 62
Reputation: 7432
What you really want to do is write stuff like this:
$(mypages[i]).find(".foo a").each(...)
the jQuery object is very non-discriminatory. It will accept just about anything and convert it into a jQuery-like object, so assuming that mypages[i]
is either an HTML string, jQuery object, or DOM Element, that should do it for ya
Upvotes: 3