Magic AndWebDev Magic AndWebDev - 1 year ago 83
jQuery Question

How to use JQuery selectors on a HTML String?

$.get(url, function(data){}


This jQuery function returns a string with the code of the page 'url'.

How can I use the jQuery selectors on it to extract the tags informations that I need?

Answer Source

wrap your data with div (for including the outer most element also to extract the tags) and than use find

$("<div>" + data + "</div>").find('div')
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download